Why is that a bug? your numbers are ints it does an int calculation an
then extends the result to store it/ return it (the rules when C does
implicit casts are not always intuitive :/ )

if you want to force the compiler to use a different number type than
int (which is 16 bits for the MSP430) you could write 1L << 30

chris

Rick Jenkins schrieb:
> Compiling:
> 
> static long bug(void)
> {
>   long bugged;
> 
>   bugged = 1 << 30;
>   return( bugged );
> }
> 
> Produces:
> 
> msp430-gcc -mmcu=msp430x1611 -pipe -O2 -mendup-at=main -g -minline-hwmul -fno-
> defer-pop -I ../include -I ../proc1 -Wall -W -Wcast-align -Wcast-qual -
> Wmissing-declarations -Wmissing-prototypes -Wnested-externs -Wpointer-arith -
> Wredundant-decls -Wreturn-type -Wshadow -Wstrict-prototypes -Wswitch -Wunused 
> -Wwrite-strings -Winline   -c -o bug.o bug.c
> bug.c: In function `bug':
> bug.c:5: warning: left shift count >= width of type
> 
> Using:
>> msp430-gcc --version
> msp430-gcc (GCC) 3.2.3
> 
> compiled from CVS using the makefile in "packaging", as advised in the 
> documentation.
> 


Reply via email to