This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/29868] Incorrect code generated for comparison
- From: "michael dot chapman at cortus dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 16 Nov 2006 11:52:55 -0000
- Subject: [Bug c/29868] Incorrect code generated for comparison
- References: <bug-29868-13576@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- 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