[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 09:02:00 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:

This pass runs after name resolution and expression analysis, so the `Variable` here in the parse tree has a fully typed `Expr<SomeType>` representation, so you could do this analysis on real resolved symbols.

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


More information about the flang-commits mailing list