[flang] Extend common block size to cover equivalence storage
authorJean Perier <jperier@nvidia.com>
Fri, 3 Sep 2021 06:12:44 +0000 (08:12 +0200)
committerJean Perier <jperier@nvidia.com>
Fri, 3 Sep 2021 06:13:39 +0000 (08:13 +0200)
commit084d8bebd0fcad80b0b2890e427e804ca42431d8
tree8beedb3ace2aa2687cd68862b07521a8f3dfa602
parent0f80961e8c72dd67e1d9a9817b581b9848c9393e
[flang] Extend common block size to cover equivalence storage

The size of common block should be extended to cover any storage
sequence that are storage associated with the common block via
equivalences (8.10.2.2 point 1 (2)).

In symbol size and offset computation, the size of the common block
was not always extended to cover storage association. It was only done
if the "base symbol of an equivalence group"(*) appeared in a common block
statement. Correct this to cover all cases where a symbol appearing in a
common block statement is storage associated.

(*) the base symbol of an equivalence group is the symbol whose storage
starts first in a storage association (if several symbols starts first,
the base symbol is the last one visited by the algorithm going through
the equivalence sets).

Differential Revision: https://reviews.llvm.org/D109156
flang/lib/Semantics/compute-offsets.cpp
flang/test/Semantics/offsets03.f90