This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

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


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);
}

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]