This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c/30475] assert(int+100 > int) optimized away



------- 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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]