Optimiser bug in GCC 4.0.4

June 16th, 2006 tonyg

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.

Entry Filed under: Technology

Leave a Comment

Required

Required, hidden

Some HTML allowed:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <code> <em> <i> <strike> <strong>

Trackback this post  |  Subscribe to the comments via RSS Feed

Calendar

June 2006
M T W T F S S
« May   Jul »
 1234
567891011
12131415161718
19202122232425
2627282930  

Most Recent Posts