avr-gcc-list
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [avr-gcc-list] odd left-shift behavior, avr-gcc 4.1.2


From: John Regehr
Subject: Re: [avr-gcc-list] odd left-shift behavior, avr-gcc 4.1.2
Date: Sun, 9 Dec 2007 09:20:02 -0700 (MST)

>   int32_t x = ((uint16_t)0xffffL) << ((uint32_t)1L);
> 
> puts 0xfffe into x, as opposed to 0x1fffe as I would have expected.  Is a C
> compiler not required to promote such that both operands of a shift are the
> same size?

Should have added: this was compiling for Mega128 and the behavior is 
robust across -O0, -O1, -O2, -Os, -O3.  On the other hand, given the same 
input x86 gcc robustly puts 0x1fffe into x.

John Regehr




reply via email to

[Prev in Thread] Current Thread [Next in Thread]