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/54852] Bogus(?) warnings when compiling gfortran.dg/bind_c_vars.f90 gfortran.dg/bind_c_vars_driver.c with -flto


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54852

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |diagnostic, lto
             Status|WAITING                     |NEW

--- Comment #3 from Richard Biener <rguenth at gcc dot gnu.org> ---
LTO warns that

/space/rguenther/src/svn/trunk/gcc/testsuite/gfortran.dg/bind_c_vars_driver.c:12:5:
warning: type of 'myF90Array2D' does not match original declaration [enabled by
default]
/space/rguenther/src/svn/trunk/gcc/testsuite/gfortran.dg/bind_c_vars.f90:16:0:
note: previously declared here
/space/rguenther/src/svn/trunk/gcc/testsuite/gfortran.dg/bind_c_vars_driver.c:11:5:
warning: type of 'myF90Array3D' does not match original declaration [enabled by
default]
/space/rguenther/src/svn/trunk/gcc/testsuite/gfortran.dg/bind_c_vars.f90:15:0:
note: previously declared here

which effectively means that assignments in GIMPLE between those arrays
would be invalid (not array members but whole arrays).  Not sure if we
can create a testcase that will eventually ICE though.  Usually the above
also means that the arrays use different alias sets but that's safe here
because the alias set of an array is that of its element (and those are
compatible here).

The issue is that in C a[2][3] is ARRAY_TYPE <ARRAY_TYPE <...> > but
GFortran represents a(2)(3) as 1D ARRAY_TYPE <...> and thus both types
are not structurally equivalent (which is why LTO warns).

Not sure if this case is motivation enough to treat arrays structurally
the same if their overall size is the same.


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