[flang] Fix common block size extension mistake in D109156

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.

Differential Revision: https://reviews.llvm.org/D109439
This commit is contained in:
Jean Perier 2021-09-09 09:11:49 +02:00
parent d42f76fd36
commit d892d7323e
2 changed files with 5 additions and 1 deletions

View File

@ -154,7 +154,7 @@ void ComputeOffsetsHelper::DoCommonBlock(Symbol &commonBlock) {
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);
}

View File

@ -56,4 +56,8 @@ module me
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