[flang-commits] [PATCH] D153786: [flang] Catch error: COMMON block and implicit interface external subprogram with same name

Peter Klausler via Phabricator via flang-commits flang-commits at lists.llvm.org
Tue Jun 27 13:18:48 PDT 2023


This revision was automatically updated to reflect the committed changes.
Closed by commit rG1c900ed37398: [flang] Catch error: COMMON block and implicit interface external subprogram… (authored by klausler).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D153786/new/

https://reviews.llvm.org/D153786

Files:
  flang/lib/Semantics/check-declarations.cpp
  flang/test/Semantics/declarations04.f90


Index: flang/test/Semantics/declarations04.f90
===================================================================
--- flang/test/Semantics/declarations04.f90
+++ flang/test/Semantics/declarations04.f90
@@ -23,3 +23,9 @@
   !PORTABILITY: Global name 'ext4' conflicts with a module
   common /ext4/ x
 end
+
+subroutine s
+  !ERROR: Two entities have the same global name 'foo'
+  common /foo/n
+  call foo
+end
Index: flang/lib/Semantics/check-declarations.cpp
===================================================================
--- flang/lib/Semantics/check-declarations.cpp
+++ flang/lib/Semantics/check-declarations.cpp
@@ -2552,7 +2552,8 @@
   } else {
     const std::string *bindC{symbol.GetBindName()};
     if (symbol.has<CommonBlockDetails>() ||
-        IsExternalProcedureDefinition(symbol)) {
+        IsExternalProcedureDefinition(symbol) ||
+        (symbol.owner().IsGlobal() && IsExternal(symbol))) {
       return bindC ? *bindC : symbol.name().ToString();
     } else if (bindC &&
         (symbol.has<ObjectEntityDetails>() || IsModuleProcedure(symbol))) {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D153786.535108.patch
Type: text/x-patch
Size: 1076 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/flang-commits/attachments/20230627/94e95ee5/attachment-0001.bin>


More information about the flang-commits mailing list