[PATCH] D109439: [flang] Fix common block size extension mistake in D109156

Jean Perier via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 8 08:12:34 PDT 2021


jeanPerier created this revision.
jeanPerier added reviewers: klausler, schweitz.
jeanPerier added a project: Flang.
Herald added a subscriber: jdoerfert.
jeanPerier requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

https://reviews.llvm.org/D109156 did not properly update the case where
the equivalence symbol appearing in the common statement is the
"base symbol of an equivalence group" (this was the only case that previously
worked ok, and the patch broke it).

Fix this and add a test that actually uses this code path.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D109439

Files:
  flang/lib/Semantics/compute-offsets.cpp
  flang/test/Semantics/offsets03.f90


Index: flang/test/Semantics/offsets03.f90
===================================================================
--- flang/test/Semantics/offsets03.f90
+++ flang/test/Semantics/offsets03.f90
@@ -56,4 +56,8 @@
   equivalence(i4, l4)
   equivalence(l4(10), k4)
   common /common6/ i4, j4   ! CHECK: common6 size=76 offset=0: CommonBlockDetails alignment=4:
+
+  integer :: i5, j5, l5(10)
+  equivalence(l5(1), i5)
+  common /common7/ j5, i5   ! CHECK: common7 size=44 offset=0: CommonBlockDetails alignment=4:
 end
Index: flang/lib/Semantics/compute-offsets.cpp
===================================================================
--- flang/lib/Semantics/compute-offsets.cpp
+++ flang/lib/Semantics/compute-offsets.cpp
@@ -154,7 +154,7 @@
     auto eqIter{equivalenceBlock_.end()};
     auto iter{dependents_.find(symbol)};
     if (iter == dependents_.end()) {
-      auto eqIter = equivalenceBlock_.find(symbol);
+      eqIter = equivalenceBlock_.find(symbol);
       if (eqIter != equivalenceBlock_.end()) {
         DoEquivalenceBlockBase(symbol, eqIter->second);
       }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D109439.371340.patch
Type: text/x-patch
Size: 1071 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210908/28f62206/attachment.bin>


More information about the llvm-commits mailing list