This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: 20040309-1.c vs overflow being undefined


Andrew Pinski <pinskia@physics.uc.edu> writes:

> x is promoted to a signed int by the front-end as the type
> of 32768 is signed.  So when we pass 65535 to foo (like in the testcase),
> we get some large negative number for (signed int)x

I don't see how you can get a large negative number for that.  With 16 bit
ints you'll get -1, but for anything bigger you'll keep 65535.

Andreas.

-- 
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany
PGP key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]