This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/30475] assert(int+100 > int) optimized away
- From: "pinskia at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 21 Jan 2007 08:58:31 -0000
- Subject: [Bug c/30475] assert(int+100 > int) optimized away
- References: <bug-30475-3511@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #30 from pinskia at gcc dot gnu dot org 2007-01-21 08:58 -------
GCC is not going to change. There is no reason why you can't either use
-fwrapv or change the security checks to be before the overflow happens. There
are now good reasons why -fwrapv is not on by default, if you look at:
int f(int max, int *t)
{
int i;
for(i = 0;i<=max;i++)
{
if (i<0) return 1;
t[i]++;
}
return 0;
}
The "if (i<0)" should always be removed as i can never be negative.
--
pinskia at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution| |WONTFIX
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30475