[Bug middle-end/88780] [12/13/14/15 Regression] bogus -Wstringop-truncation for copying as many bytes from a string as its length
law at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Mon Feb 17 04:39:51 GMT 2025
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88780
--- Comment #16 from Jeffrey A. Law <law at gcc dot gnu.org> ---
Some thoughts.
The block with the key statements looks like:
<bb 4> :
__builtin_strncpy (d_8(D), s_5(D), len_6);
_2 = d_8(D) + len_6;
*_2 = 0;
We probably need to recover the array indexing and produce the equivalent of
<bb 4> :
__builtin_strncpy (d_8(D), s_5(D), len_6);
d[len_6] = 0;
Then we probably need to factor the hack that looks past the strncpy so that it
works in maybe_diag_stxncpy_trunc.
Probably not gcc-15 material, but that's a path forward.
More information about the Gcc-bugs
mailing list