New testcases.

Bernd Schmidt bernds@balti.cygnus.co.uk
Thu Jan 6 08:06:00 GMT 2000


On Thu, 6 Jan 2000, Franz Sirl wrote:

> Am Don, 02 Dez 1999 schrieb Bernd Schmidt:
> >unsigned int f (unsigned int a)
> >{
> >  return a * 65536 / 8;
> >}
> >
> >unsigned int g (unsigned int a)
> >{
> >  return a * 65536;
> >}
> >
> >unsigned int h (unsigned int a)
> >{
> >  return a / 8;
> >}
> >
> >int main ()
> >{
> >  if (f (65536) != h (g (65536)))
> >    abort ();
> >  exit (0);
> >}
> 
> I think this testcase is bogus (at least on sizeof int == 4 platforms).

Why do you believe that?  It's validating that the compiler handles
unsigned overflow correctly, i.e. it doesn't optimize "a * 65536 / 8" to
"a * 8192".

There was a discussion about this shortly before I checked in the
testcase.


Bernd



More information about the Gcc-patches mailing list