This is the mail archive of the gcc-bugs@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: Invalid right shift in genautomata.c


Neil Booth wrote:
> 
> When compiling an i960-wrs-vxworks cross compiler I get
> 
> gcc -c -DIN_GCC -DCROSS_COMPILE    -W -Wall -Wwrite-strings
> -Wstrict-prototypes -Wmissing-prototypes -Wtraditional -pedantic
> -Wno-long-long  -DHAVE_CONFIG_H -DGENERATOR_FILE    -I. -I. -I../../gcc
> -I../../gcc/. -I../../gcc/config -I../../gcc/../include
> ../../gcc/genautomata.c -o genautomata.o
> ../../gcc/genautomata.c: In function `reserv_sets_hash_value':
> ../../gcc/genautomata.c:3419: warning: right shift count >= width of
> type
> 
> IMO this is a bug and should be fixed.
> 

  Actually this is not a bug, Neil.  The shift is not used when compiler
generates the message (it is even gone after dead code elimination).

  To speed up genautomata, all bit operations are executed on
HOST_WIDE_INT.  This type is used also to hash the bitstring.  Htab uses
unsigned as a hash key.  So I need to convert HOST_WIDE_INT into
unsigned.  I could make it by `(unsigned) key'.  But that would result
in bad hash keys when the number units > sizeof (unsigned) * CHAR_BIT. 
Therefore I hash HOST_WIDE_INT using the shift.  But it is made only
when sizeof (unsigned) < sizeof (HOST_WIDE_INT).

Vlad


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