sibcall bug in ss-20000724 for i686-pc-linux

Thomas R. Truscott trt@cs.duke.edu
Mon Jul 31 11:52:00 GMT 2000


In the program below, the optimizer turns do_sibcall's "call foo"
into "branch foo".  Unforunately for ia32, foo
returns a double that is pushed onto the floating point stack
and the caller must clean that up.
That would happen if do_sibcall also returned a double,
but alas it returns void.

On i686-pc-linux, "gcc -O2" does sibcall optimization
and the resulting program calls abort.

Tom Truscott

double
foo (void)
{
  return 0.0;
}

void
do_sibcall (void)
{
  (void) foo ();
}

int
main (void)
{
   double x;

   for (x = 0; x < 20; x++)
      do_sibcall ();
   if (!(x >= 10))
      abort ();
   exit (0);
}


More information about the Gcc-bugs mailing list