This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug tree-optimization/84561] -Wstringop-truncation with -O2 depends on strncpy's size type
- From: "msebor at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Mon, 26 Feb 2018 17:08:52 +0000
- Subject: [Bug tree-optimization/84561] -Wstringop-truncation with -O2 depends on strncpy's size type
- Auto-submitted: auto-generated
- References: <bug-84561-4@http.gcc.gnu.org/bugzilla/>
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.