[Bug c/29868] Incorrect code generated for comparison

michael dot chapman at cortus dot com gcc-bugzilla@gcc.gnu.org
Thu Nov 16 11:53:00 GMT 2006



------- Comment #3 from michael dot chapman at cortus dot com  2006-11-16 11:52 -------
Subject: Re:  Incorrect code generated for comparison

rguenth at gcc dot gnu dot org wrote:
> ------- Comment #2 from rguenth at gcc dot gnu dot org  2006-11-16 11:42 -------
> This is invalid.  Adding 0x10000001 to 7 * 0x10000001 invokes undefined
> behavior
> (so you get the wrapped result, which is negative and you abort).
>
>
>   
I was expecting to see a branch less than (or its inverse) somewhere in 
the code,
and not a branch not equal to 0x7fffffff. This would have given the 
expected behaviour.

But I think your are right.
Legalisticly of course overflowing gives an undefined result, so the 
result of the compiler is not incorrect.

Ok. Please kill the bug report.

Mike


-- 


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



More information about the Gcc-bugs mailing list