[flang-commits] [PATCH] D127790: [flang] Add more qualification when creating names for compiler-generated USEs

Peter Klausler via Phabricator via flang-commits flang-commits at lists.llvm.org
Tue Jun 14 13:58:50 PDT 2022


klausler created this revision.
klausler added a reviewer: kiranchandramohan.
klausler added a project: Flang.
Herald added a subscriber: jdoerfert.
Herald added a project: All.
klausler requested review of this revision.

When generic resolution finds its specific procedure in a module,
and that specific procedure is not use-associated into the local scope
(perhaps because it was PRIVATE, perhaps because the generic was
use-associated with ONLY:), we create a new use-association with
a renaming.  The name constructed for this renaming needs to be
additionally qualified with the module name of the specific procedure
in order to avoid clashing with another specific of the same name
that may have previously been use-associated in the same way from
a distinct module.


https://reviews.llvm.org/D127790

Files:
  flang/lib/Semantics/expression.cpp
  flang/test/Semantics/modfile39.f90


Index: flang/test/Semantics/modfile39.f90
===================================================================
--- flang/test/Semantics/modfile39.f90
+++ flang/test/Semantics/modfile39.f90
@@ -36,11 +36,11 @@
 !Expect: m2.mod
 !module m2
 !use m1,only:gen
-!use m1,only:m1$priv=>priv
-!private::m1$priv
+!use m1,only:m1$m1$priv=>priv
+!private::m1$m1$priv
 !contains
 !subroutine s(a)
-!real(4)::a(1_8:int(m1$priv(1_4),kind=8))
+!real(4)::a(1_8:int(m1$m1$priv(1_4),kind=8))
 !end
 !end
 
Index: flang/lib/Semantics/expression.cpp
===================================================================
--- flang/lib/Semantics/expression.cpp
+++ flang/lib/Semantics/expression.cpp
@@ -2210,6 +2210,7 @@
     // Create a renaming USE of the specific procedure.
     auto rename{context_.SaveTempName(
         used->symbol().owner().GetName().value().ToString() + "$" +
+        specific.owner().GetName().value().ToString() + "$" +
         specific.name().ToString())};
     return *const_cast<semantics::Scope &>(scope)
                 .try_emplace(rename, specific.attrs(),


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D127790.436923.patch
Type: text/x-patch
Size: 1072 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/flang-commits/attachments/20220614/81bce886/attachment.bin>


More information about the flang-commits mailing list