Optimiser bug in GCC 4.0.4

By: on June 16, 2006

Q: When is (i != 0) equivalent to

((i >= 0) && ((i >= -1073741824) && (i < 1073741824))) ? A: When GCC 4.0.4’s -O, -O1, -O2 or -O3 is used on it.

See GCC bug 28042. Particularly interesting is that removing the redundant set of parentheses around the second && avoids the optimiser bug.


Leave a Reply

Your email address will not be published.

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>