[flang-commits] [PATCH] D159030: [flang] Don't implicitly host-associate unknown EQUIVALENCE designators

Peter Klausler via Phabricator via flang-commits flang-commits at lists.llvm.org
Tue Aug 29 08:33:54 PDT 2023


This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG4d32f9ad0eb7: [flang] Don't implicitly host-associate unknown EQUIVALENCE designators (authored by klausler).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D159030

Files:
  flang/lib/Semantics/resolve-names.cpp
  flang/test/Semantics/offsets03.f90


Index: flang/test/Semantics/offsets03.f90
===================================================================
--- flang/test/Semantics/offsets03.f90
+++ flang/test/Semantics/offsets03.f90
@@ -29,7 +29,7 @@
 
 ! Common block: objects are in order from COMMON statement and not part of module
 module md                   !CHECK: Module scope: md size=1 alignment=1
-  integer(1) :: i 
+  integer(1) :: i
   integer(2) :: d1          !CHECK: d1, PUBLIC size=2 offset=8:
   integer(4) :: d2          !CHECK: d2, PUBLIC size=4 offset=4:
   integer(1) :: d3          !CHECK: d3, PUBLIC size=1 offset=0:
@@ -65,3 +65,13 @@
   equivalence(a1,a3(1)),(a2,a3(2))
   common /common8/ a1, a2   ! CHECK: common8 size=8 offset=0: CommonBlockDetails alignment=4:
 end
+
+! Ensure EQUIVALENCE of undeclared names in internal subprogram doesn't
+! attempt to host-associate
+subroutine host1
+ contains
+  subroutine internal
+    common /b/ x(4)  ! CHECK: x (Implicit) size=16 offset=0: ObjectEntity type: REAL(4) shape: 1_8:4_8
+    equivalence(x,y) ! CHECK: y (Implicit) size=4 offset=0: ObjectEntity type: REAL(4)
+  end
+end
Index: flang/lib/Semantics/resolve-names.cpp
===================================================================
--- flang/lib/Semantics/resolve-names.cpp
+++ flang/lib/Semantics/resolve-names.cpp
@@ -7277,7 +7277,7 @@
 // be wrong we report an error later in CheckDeclarations().
 bool DeclarationVisitor::CheckForHostAssociatedImplicit(
     const parser::Name &name) {
-  if (!inSpecificationPart_) {
+  if (!inSpecificationPart_ || inEquivalenceStmt_) {
     return false;
   }
   if (name.symbol) {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D159030.554368.patch
Type: text/x-patch
Size: 1617 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/flang-commits/attachments/20230829/35ff30ba/attachment-0001.bin>


More information about the flang-commits mailing list