Test with an lto-build of libgfortran.
Andrew Pinski
pinskia@gmail.com
Thu Sep 28 06:29:40 GMT 2023
On Wed, Sep 27, 2023 at 11:28 PM Richard Biener via Fortran
<fortran@gcc.gnu.org> wrote:
>
> On Wed, Sep 27, 2023 at 11:48 PM Jeff Law via Fortran
> <fortran@gcc.gnu.org> wrote:
> >
> >
> >
> > On 9/27/23 12:21, Toon Moene wrote:
> >
> > >
> > > The lto-ing of libgfortran did succeed, because I did get a new warning:
> > >
> > > gfortran -O3 -flto -flto-partition=none -static -o xlintstrfz zchkrfp.o
> > > zdrvrfp.o zdrvrf1.o zdrvrf2.o zdrvrf3.o zdrvrf4.o zerrrfp.o zlatb4.o
> > > zlaipd.o zlarhs.o zsbmv.o zget04.o zpot01.o zpot03.o zpot02.o chkxer.o
> > > xerbla.o alaerh.o aladhd.o alahd.o alasvm.o ../../libtmglib.a
> > > ../../liblapack.a ../../librefblas.a
> > > In function 'xtoa_big',
> > > inlined from 'write_z' at
> > > /home/toon/compilers/gcc/libgfortran/io/write.c:1296:11,
> > > inlined from 'formatted_transfer_scalar_write' at
> > > /home/toon/compilers/gcc/libgfortran/io/transfer.c:2136:4:
> > > /home/toon/compilers/gcc/libgfortran/io/write.c:1222:6: warning: writing
> > > 1 byte into a region of size 0 [-Wstringop-overflow=]
> > > 1222 | *q = '\0';
> > > | ^
> > > /home/toon/compilers/gcc/libgfortran/io/write.c: In function
> > > 'formatted_transfer_scalar_write':
> > > /home/toon/compilers/gcc/libgfortran/io/write.c:1291:8: note: at offset
> > > [34, 4294967294] into destination object 'itoa_buf' of size 33
> > > 1291 | char itoa_buf[GFC_XTOA_BUF_SIZE];
> > > | ^
> > >
> > > which was (of course) not given with a non-lto libgfortran.
> > Yea. This certainly can happen with LTO. These warnings would
> > definitely be something worth investigating.
> >
> > Essentially the inlining enabled by LTO can expose a different set of
> > diagnostics.
>
> This particular place in libgfortran has
>
> /* write_z, which calls xtoa_big, is called from transfer.c,
> formatted_transfer_scalar_write. There it is passed the kind as
> argument, which means a maximum of 16. The buffer is large
> enough, but the compiler does not know that, so shut up the
> warning here. */
> #pragma GCC diagnostic push
> #pragma GCC diagnostic ignored "-Wstringop-overflow"
> *q = '\0';
> #pragma GCC diagnostic pop
>
> so obviously the #pragma doesn't survive through LTO. Somehow I think
> this is a known bug, but maybe I misremember (I think we are not streaming
> any of the ad-hoc location parts).
Yes it is a known bug.
See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80922 .
Thanks,
Andrew
>
> Richard.
>
> >
> > Jeff
More information about the Gcc
mailing list