[Bug c/59301] Please enable -Wstrict-overflow as part of -Wextra
vincent-gcc at vinc17 dot net
gcc-bugzilla@gcc.gnu.org
Mon Apr 14 12:19:00 GMT 2014
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59301
Vincent Lefèvre <vincent-gcc at vinc17 dot net> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |vincent-gcc at vinc17 dot net
--- Comment #1 from Vincent Lefèvre <vincent-gcc at vinc17 dot net> ---
(In reply to Joerg Wunsch from comment #0)
> I think it would be much better to include -Wstrict-overflow into -Wextra,
> so people get aware of the potential problems.
I disagree: there are currently too many false positives.
For your particular problem, the bug is somewhere else: the undefined behavior
in --i for some value, and this is now detected by GCC:
ypig:~> gcc-4.9 -O2 -fstrict-overflow -c z.c
z.c: In function ‘main’:
z.c:4:11: warning: iteration 2147483648u invokes undefined behavior
[-Waggressive-loop-optimizations]
while (--i)
^
z.c:4:11: note: containing loop
ypig:~> gcc-4.9 --version
gcc-4.9.real (Debian 4.9-20140411-2) 4.9.0 20140411 (prerelease)
[gcc-4_9-branch revision 209311]
Copyright (C) 2014 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
So, IMHO, this bug should be closed.
More information about the Gcc-bugs
mailing list