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

J.C. Pizarro jcpiza@gmail.com
Wed Mar 28 01:12:00 GMT 2007


2007/3/28, Andreas Schwab <schwab@suse.de>:
> "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.

Very thanks, LL and %lld are the solution. The GCC compiler has not
bugs that i said.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: testing_long_GCC_march2007_3.tar.gz
Type: application/x-gzip
Size: 1354 bytes
Desc: not available
URL: <https://gcc.gnu.org/pipermail/gcc/attachments/20070328/57eb27bb/attachment.bin>


More information about the Gcc mailing list