Test with an lto-build of libgfortran.

Tobias Burnus tobias@codesourcery.com
Thu Sep 28 07:29:02 GMT 2023


Hi all,

the following works for me. I have only tried a normal build (where it
does silence the same warning) and not an LTO build and I just believed
the comment - see attached patch. Comments?

On 28.09.23 08:25, Richard Biener via Fortran wrote:

> 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).

I have replaced it now by the assert that "len <= 16", i.e.

+  if (len > 16)
+    __builtin_unreachable ();

Build + tested on x86-64-gnu-linux
Comment? OK for mainline?

Tobias
-----------------
Siemens Electronic Design Automation GmbH; Anschrift: Arnulfstraße 201, 80634 München; Gesellschaft mit beschränkter Haftung; Geschäftsführer: Thomas Heurung, Frank Thürauf; Sitz der Gesellschaft: München; Registergericht München, HRB 106955
-------------- next part --------------
A non-text attachment was scrubbed...
Name: xtoa_big-silence-warning.diff
Type: text/x-patch
Size: 1583 bytes
Desc: not available
URL: <https://gcc.gnu.org/pipermail/gcc/attachments/20230928/97d96eb5/attachment.bin>


More information about the Gcc mailing list