This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: sizetype overflow?
- To: rth at redhat dot com
- Subject: Re: sizetype overflow?
- From: kenner at vlsi1 dot ultra dot nyu dot edu (Richard Kenner)
- Date: Tue, 14 Nov 00 05:32:34 EST
- Cc: gcc-bugs at gcc dot gnu dot org
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:
To make sure that we correctly give an overflow in all cases where an object's
size is too large. This is required, for example, in Ada.
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
Perhaps C should do the same as C++, where the user-visible sizetype is
not the internal sizetype?