This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug middle-end/49283] pointless warning with -Wstrict-overflow
- From: "rguenth at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Mon, 6 Jun 2011 10:39:18 +0000
- Subject: [Bug middle-end/49283] pointless warning with -Wstrict-overflow
- Auto-submitted: auto-generated
- References: <bug-49283-4@http.gcc.gnu.org/bugzilla/>
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49283
--- Comment #2 from Richard Guenther <rguenth at gcc dot gnu.org> 2011-06-06 10:38:33 UTC ---
1) Line 2026 contains the expression
(p < buff + sizeof buff - 1)
GCC only looks at local tuple stmts when emitting the warning, so I suppose
it sees sth like
p = &buff[...];
p = p + 3;
(p < buff + sizeof buff - 1)
and then optimizes the last two stmts as
p + 3 < buff + sizeof buff - 1
moving the + 3 from the LHS and combining it with the constant offset
on the RHS. That is only valid if p + 3 does not get outside of buff
which GCC doesn't see (it would also be invalid, but that is what the
option tries to catch - so, catch22).