Bugs in operations of "long" type from GCC-3.4.6 32 bit.

Andreas Schwab schwab@suse.de
Wed Mar 28 00:29:00 GMT 2007


"J.C. Pizarro" <jcpiza@gmail.com> writes:

> The range of long should be -(2^63) ..  +((2^63)-1).

Your long has only 32 bits.

> For shifts, the range of a long type should be 0 .. 64 (65 values), not 0 .. 31.

Your long has only 32 bits.

>> %ld is not the correct format for a value of type long long, causing
>> undefined behaviour.
>
> %ld means long format for %d, is it wrong?

%ld is for long, not long long.

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."



More information about the Gcc mailing list