Follow up of https://reviews.llvm.org/D121488. Ensure lower bounds
are 1 when the related dimension extent is zero. Note that lower
bounds from descriptors are now guaranteed to fulfill this property
after the runtime/codegen patches.
Also fixes explicit shape array extent lowering when instantiating
variables to deal with negative extent cases (issue found while testing
LBOUND edge case). This notably caused allocation crashes when dealing
with automatic arrays with reversed bounds or negative size
specification expression. The standard specifies that the extent of such
arrays is zero. This change has some ripple effect in the current lit
tests.
Add move two helpers as part of this change:
- Add a helper to tell if a fir::ExtendedValue describes an assumed size array (last dimension extent is unknown to the compiler, both at compile time and runtime).
- Move and share getIntIfConstant from Character.cpp so that it can be used elsewhere (NFC).
You should use brace on the if block if braces are used on the else block.