This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Question about generated type for common block in fortran
- From: Michael Matz <matz at suse dot de>
- To: "Bin.Cheng" <amker dot cheng at gmail dot com>
- Cc: Richard Biener <richard dot guenther at gmail dot com>, gfortran at gcc dot gnu dot org, "gcc at gcc dot gnu dot org" <gcc at gcc dot gnu dot org>, Eric Botcazou <ebotcazou at adacore dot com>
- Date: Mon, 13 Nov 2017 11:01:17 +0100 (CET)
- Subject: Re: Question about generated type for common block in fortran
- Authentication-results: sourceware.org; auth=none
- References: <CAHFci2-Ou3jwFk0v=_hrUpeSHCpVM-Lb9JnTNDckmieAzTkzvQ@mail.gmail.com> <F09FC826-F13A-4E39-A24F-3D9E37628A92@gmail.com> <alpine.LSU.2.21.1711071650200.25295@wotan.suse.de> <CAFiYyc1qy7nfZFoT9g90ecx6SBU5P9s_9=Rtte6x+F_kfNKrJw@mail.gmail.com> <alpine.LSU.2.21.1711081541170.25295@wotan.suse.de> <CAFiYyc1d=PT-C4n2GLfjUX=uLJoZSw87JkGLktJuq03iTAxNLQ@mail.gmail.com> <CAHFci29Xni=k4EFPcbBgKSDrYRozwL3jMbtmPCM4AZ8Pu=S0Ww@mail.gmail.com>
Hi,
On Thu, 9 Nov 2017, Bin.Cheng wrote:
> So I have two questions here.
> A) Is this special kind union type only generated by fortran FE for
> equivalence+common?
It's not special in that it isn't marked in any way. For all purposes
it's a normal union type with surprising field(offset)s. I don't know if
it can occur for any situations except equivalence+common. Not from the
fortran frontend I believe.
> B) For the special union type that has non-zero offset fields. Is it
> safe to assume field A is not the last flex array: if there is field B
> that offset_B >= (offset_A + length_A)?
No. You can make equivalences between all kinds of objects,
including non-arrays. You can also equivalence (say) an integer variable
and an individual array element. Also flex arrays don't enter the
picture, you can equivalize (tm) also arrays of fixed size.
Ciao,
Michael.