[flang-commits] [flang] [flang] Fix regression in submodule symbol checking (PR #69778)

Peter Klausler via flang-commits flang-commits at lists.llvm.org
Fri Oct 20 13:50:54 PDT 2023


https://github.com/klausler created https://github.com/llvm/llvm-project/pull/69778

The change https://github.com/llvm/llvm-project/pull/67361 removed submodule name symbols from the name dictionaries of their parent (sub)modules to prevent needless errors about name clashes, but these symbols still need to be checked for things like excessive length.

>From 25a0666f6fe8d48e4c3620633922786afbc19a78 Mon Sep 17 00:00:00 2001
From: Peter Klausler <pklausler at nvidia.com>
Date: Fri, 20 Oct 2023 13:46:52 -0700
Subject: [PATCH] [flang] Fix regression in submodule symbol checking

The change https://github.com/llvm/llvm-project/pull/67361 removed
submodule name symbols from the name dictionaries of their parent
(sub)modules to prevent needless errors about name clashes, but
these symbols still need to be checked for things like excessive
length.
---
 flang/lib/Semantics/check-declarations.cpp | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/flang/lib/Semantics/check-declarations.cpp b/flang/lib/Semantics/check-declarations.cpp
index 2c2866d590ae5a4..c3a333b5917d2fd 100644
--- a/flang/lib/Semantics/check-declarations.cpp
+++ b/flang/lib/Semantics/check-declarations.cpp
@@ -2395,6 +2395,10 @@ void CheckHelper::Check(const Scope &scope) {
     for (const auto &pair : scope) {
       Check(*pair.second);
     }
+    if (scope.IsSubmodule() && scope.symbol()) {
+      // Submodule names are not in their parent's scopes
+      Check(*scope.symbol());
+    }
     for (const auto &pair : scope.commonBlocks()) {
       CheckCommonBlock(*pair.second);
     }



More information about the flang-commits mailing list