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

andreas at andreas dot org gcc-bugzilla@gcc.gnu.org
Sun Jan 21 12:49:00 GMT 2007



------- Comment #32 from andreas at andreas dot org  2007-01-21 12:49 -------
Oh, and besides, proper range analysis could optimize the above code, even in
the presence of correct (and I mean LIA-1) overflow behaviour of signed ints.

It seems you still didn't even manage to come up with an example where is
optimization matters which is not "eliminate bounds checks during array
access".  And the single reason bounds checks are done is to prevent buffer
overflow exploits.  So if you optimize that away in a situation where a LIA-1
compliant compiler would not, you're creating a security problem.

I don't see why making make_range in fold-const.c behave in compliance with
LIA-1 should be a problem, especially not performance-wise.  It would really
make a lot of people sleep better in the night.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30475



More information about the Gcc-bugs mailing list