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: "andreas at andreas dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 21 Jan 2007 12:49:43 -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 #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