[Bug middle-end/25125] [4.1/4.2 Regression] (short) ((int)(unsigned short) + (int)) is done in the wrong type
pinskia at gcc dot gnu dot org
gcc-bugzilla@gcc.gnu.org
Mon Dec 19 18:36:00 GMT 2005
------- Comment #9 from pinskia at gcc dot gnu dot org 2005-12-19 18:36 -------
(In reply to comment #8)
> (Why should we get 1? Upon entry to f, a will be 1, since 32769 will be
> reduced modulo 2^16. Then, b will be 1 - 32768, or -32767. I don't see why
> that should be converted to 1 -- but I certainly don't see why it should be
> 32768 either.)
32769 == 0x8001 .
so a will not be 1. You are thinking it is reduced modulo 2^15.
so c will be negative as 0x8001 is negative so we don't take the branch.
and then we have 0x00008001 + -0x00008000 which is equal to 1.
Thanks,
Andrew Pinski
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25125
More information about the Gcc-bugs
mailing list