This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Bugs in operations of "long" type from GCC-3.4.6 32 bit.
- From: Andreas Schwab <schwab at suse dot de>
- To: "J.C. Pizarro" <jcpiza at gmail dot com>
- Cc: gcc at gcc dot gnu dot org
- Date: Wed, 28 Mar 2007 01:08:06 +0200
- Subject: Re: Bugs in operations of "long" type from GCC-3.4.6 32 bit.
- References: <998d0e4a0703271531l1f75f170n740100b019c66af2@mail.gmail.com>
"J.C. Pizarro" <jcpiza@gmail.com> writes:
> Brief summary, there are 3 bugs:
None of them are bugs in the compiler, only in your program.
> 1. Error and Warning in assignment of a long constant (with L letter)
> (it's not true that a = 1410065408, high(a) = 0x00000000).
The constant overflows the range of long, causing undefined behaviour.
> 2. Warning in shifts << & >> of a long variable (i don't know if there
> is an error).
A shift count greater than or equal to the width of a type causes
undefined behaviour.
> 3. Error in multiply of long variables. (it's not true that c = -1486618624).
%ld is not the correct format for a value of type long long, causing
undefined behaviour.
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."