[flang-commits] [flang] [flang][semantics] add semantic check that STAT and ERRMSG are not (de)allocated by same statement (PR #164529)

Peter Klausler via flang-commits flang-commits at lists.llvm.org
Wed Oct 22 11:32:55 PDT 2025


================
@@ -141,11 +143,15 @@ static std::optional<AllocateCheckerInfo> CheckAllocateOptions(
             [&](const parser::StatOrErrmsg &statOrErr) {
               common::visit(
                   common::visitors{
-                      [&](const parser::StatVariable &) {
+                      [&](const parser::StatVariable &var) {
                         if (info.gotStat) { // C943
                           context.Say(
                               "STAT may not be duplicated in a ALLOCATE statement"_err_en_US);
                         }
+                        if (const auto *designator{
----------------
klausler wrote:

That would yield false negatives for runtime-dependent variables (unknown subscripts and pointers) but should not produce false positives.  But also check the first names in the designators and think about cases with `ASSOCIATE`.

https://github.com/llvm/llvm-project/pull/164529


More information about the flang-commits mailing list