[Bug tree-optimization/84561] -Wstringop-truncation with -O2 depends on strncpy's size type
msebor at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Mon Feb 26 17:10:00 GMT 2018
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84561
Martin Sebor <msebor at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |diagnostic
Status|UNCONFIRMED |NEW
Last reconfirmed| |2018-02-26
CC| |msebor at gcc dot gnu.org
Ever confirmed|0 |1
--- Comment #2 from Martin Sebor <msebor at gcc dot gnu.org> ---
Confirmed. The warning suppression code sees the following statements:
<bb 2> :
_8 = &b_3(D)->_a;
_9 = _8;
...
_6 = &MEM[(struct String *)_1]._string;
__builtin_strncpy (_6, "123", len_7);
MEM[(struct String *)_1]._string[len_7] = 0;
but it doesn't have the smarts to figure out that _6 is &MEM[(struct String
*)_1]._string.
More information about the Gcc-bugs
mailing list