sizetype overflow?

Richard Henderson rth@redhat.com
Mon Nov 13 16:05:00 GMT 2000


What is the purpose of the following patch?

Fri Oct 20 13:33:16 2000  Richard Kenner  <kenner@vlsi1.ultra.nyu.edu>

        * fold-const.c (force_fit_type): Unsigned values can overflow
        if they are sizetype.

As far as I can tell, all it does is break the following test:

$ cat zz.c
unsigned long foo(void)
{
  return ~(sizeof(long)-1);
}
$ ./cc1 -quiet -W zz.c
zz.c: In function `foo':
zz.c:3: warning: large integer implicitly truncated to unsigned type

Which is caused by force_fit_type returning

 <integer_cst type <integer_type long unsigned int>
  constant -8>

instead of 

 <integer_cst type <integer_type long unsigned int>
  constant 18446744073709551608>


r~


More information about the Gcc-bugs mailing list