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: Bugs in operations of "long" type from GCC-3.4.6 32 bit.


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


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