[flang-commits] [flang] 08c6a32 - [flang] Don't discard lower bounds of implicit-shape named constants
Peter Klausler via flang-commits
flang-commits at lists.llvm.org
Fri Jun 3 22:49:11 PDT 2022
Author: Peter Klausler
Date: 2022-06-03T22:45:12-07:00
New Revision: 08c6a323813d44f4cb382e8f1c53ce48d32f5698
URL: https://github.com/llvm/llvm-project/commit/08c6a323813d44f4cb382e8f1c53ce48d32f5698
DIFF: https://github.com/llvm/llvm-project/commit/08c6a323813d44f4cb382e8f1c53ce48d32f5698.diff
LOG: [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
Added:
Modified:
flang/lib/Evaluate/check-expression.cpp
Removed:
################################################################################
diff --git a/flang/lib/Evaluate/check-expression.cpp b/flang/lib/Evaluate/check-expression.cpp
index 789e0a2de7d2e..2071b12b1dcf9 100644
--- a/flang/lib/Evaluate/check-expression.cpp
+++ b/flang/lib/Evaluate/check-expression.cpp
@@ -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,
More information about the flang-commits
mailing list