[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
Mon Jun 26 10:03:40 PDT 2023
klausler created this revision.
klausler added a reviewer: PeteSteinfeld.
klausler added a project: Flang.
Herald added subscribers: sunshaoce, jdoerfert.
Herald added a project: All.
klausler requested review of this revision.
Declaration checking catches the error of a COMMON block and a subprogram
definition having the same name, but misses the case of a COMMON block
and an a reference to an external subprogram with an implicit interface.
Fix. Fixes bug https://github.com/llvm/llvm-project/issues/63247.
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.534624.patch
Type: text/x-patch
Size: 1076 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/flang-commits/attachments/20230626/66a1cdbc/attachment-0001.bin>
More information about the flang-commits
mailing list