This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: 20040309-1.c vs overflow being undefined
- From: Andrew Pinski <pinskia at physics dot uc dot edu>
- To: schwab at suse dot de (Andreas Schwab)
- Cc: pinskia at physics dot uc dot edu (Andrew Pinski), gcc at gcc dot gnu dot org
- Date: Sun, 27 Nov 2005 12:21:35 -0500 (EST)
- Subject: Re: 20040309-1.c vs overflow being undefined
>
> Andrew Pinski <pinskia@physics.uc.edu> writes:
>
> > x is promoted to a signed int by the front-end as the type
> > of 32768 is signed. So when we pass 65535 to foo (like in the testcase),
> > we get some large negative number for (signed int)x
>
> I don't see how you can get a large negative number for that. With 16 bit
> ints you'll get -1, but for anything bigger you'll keep 65535.
sorry wrong number, I had meant 32769.
if (foo (32769) != 1)
abort ();
-- Pinski