This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug fortran/41227] COMMON block, BIND(C) and LTO interoperability issues


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=41227

--- Comment #19 from rguenther at suse dot de <rguenther at suse dot de> ---
On Mon, 14 Jul 2014, burnus at gcc dot gnu.org wrote:

> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=41227
> 
> --- Comment #17 from Tobias Burnus <burnus at gcc dot gnu.org> ---
> (In reply to Francois-Xavier Coudert from comment #12)
> > I disagree with Tobias' reading: it seems to me that the single-variable
> > common block should be interoperable with both the single-common C struct
> > and C variable.
> 
> Well, Bill Long of Cray seems to agree with my interpretation, cf.
> http://mailman.j3-fortran.org/pipermail/j3/2010-February/003358.html

But that answer suggests we get it wrong (currenty interoperating
with the C struct { int i; } works and with the plain decl it
doesn't).  The answer specifically doesn't say that only (1)
is valid.

> > The Intel compiler makes both cases work:
> 
> Well, it also works with gfortran - the question is only whether it works by
> chance or by purpose. If it works by chance and is invalid LTO is not required
> to support it.

Currently it works "by chance" because without LTO the compiler doesn't
see both sides.  With LTO it notices there is an inconsistency that
with a clever testcase will result in wrong code (make a fortran
subroutine that assigns sth to the variable, call it from the
C main after its assignment of 42, read the var again in main
and see it optimized to '42' in case the fortran function call is
inlined)


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]