forked from OSchip/llvm-project
[flang] Don't discard lower bounds of implicit-shape named constants
F18 preserves lower bounds of explicit-shape named constant arrays, but failed to also do so for implicit-shape named constants. Fix. Differential Revision: https://reviews.llvm.org/D127021
This commit is contained in:
parent
f3278e0f3c
commit
08c6a32381
|
@ -418,7 +418,10 @@ std::optional<Expr<SomeType>> NonPointerInitializationExpr(const Symbol &symbol,
|
|||
int symRank{GetRank(symTS->shape())};
|
||||
if (IsImpliedShape(symbol)) {
|
||||
if (folded.Rank() == symRank) {
|
||||
return {std::move(folded)};
|
||||
return ArrayConstantBoundChanger{
|
||||
std::move(*AsConstantExtents(
|
||||
context, GetRawLowerBounds(context, NamedEntity{symbol})))}
|
||||
.ChangeLbounds(std::move(folded));
|
||||
} else {
|
||||
context.messages().Say(
|
||||
"Implied-shape parameter '%s' has rank %d but its initializer has rank %d"_err_en_US,
|
||||
|
|
Loading…
Reference in New Issue