[flang-commits] [flang] [Flang] Diagnose nonvariable STAT= specifiers (PR #219696)
via flang-commits
flang-commits at lists.llvm.org
Wed Sep 16 02:12:28 PDT 2026
================
@@ -1620,6 +1620,10 @@ MaybeExpr ExpressionAnalyzer::Analyze(const parser::CoindexedNamedObject &x) {
std::get_if<Expr<SomeInteger>>(&expr->u)}) {
if (coarrayRef.stat()) {
Say("coindexed reference has multiple STAT= specifiers"_err_en_US);
+ } else if (!IsVariable(*intExpr)) {
+ // A parser::Variable may resolve to a nonpointer
+ // function reference.
+ Say("STAT= specifier must be a scalar integer variable"_err_en_US);
----------------
keepyixiao wrote:
Done, thanks. I changed the diagnostic to use SayAt(x.v, ...) and added the suggested regression test with two invalid STAT= specifiers. Each diagnostic is now anchored at its corresponding MASK(...) operand.
test.f90:4:25: error: STAT= specifier must be a scalar integer variable
r = c[1,2,3, STAT=MASK(2), STAT=MASK(3)]
^^^^^^^
test.f90:4:39: error: STAT= specifier must be a scalar integer variable
r = c[1,2,3, STAT=MASK(2), STAT=MASK(3)]
^^^^^^^
https://github.com/llvm/llvm-project/pull/219696
More information about the flang-commits
mailing list