flang-compiler / f18-llvm-project

Fork of llvm/llvm-project for f18. In sync with f18-mlir and f18.
http://llvm.org
28 stars 16 forks source link

Handle reversed bounds and negative length in inlined allocation #1587

Closed jeanPerier closed 2 years ago

jeanPerier commented 2 years ago

ALLOCATE statement allows reversed bounds (see Fortran 2018 9.7.1.2 point 1) in which case the extents are zero.

The same applies for the character length provided in the type spec that can be negative. In which case the new length is zero.

Use genMaxWithZero to deal with these cases.