[Bug middle-end/19225] [3.4/4.0/4.1 regression] g++.dg/eh/omit-frame-pointer2.C fails with -fpic/-fPIC on i686-pc-linux-gnu

pinskia at gcc dot gnu dot org gcc-bugzilla@gcc.gnu.org
Mon Mar 21 21:59:00 GMT 2005


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-03-21 21:59 -------
>From PR 20581:
"The following is a slightly modified version of g++.dg/eh/omit-frame-pointer2.C.
It fails with -O -fomit-frame-pointer -mno-accumulate-outgoing-args -fpic (you
need all flags).  Basic problem is that there are 24 bytes on the stack at the point of
the call to f2, which throws, but the code following the landing pad only pops 12 of
them, so the return from f1 does not pick up the right address.  The unwinder could 
in principle adjust SP to compensate, but it doesn't; there seems to be sufficient info 
in the tables to do this, but no such code in the unwinder.  I am unsure just how this 
is supposed to work.
// Reduced from PR c++/5246, PR c++/2447
// { dg-options "-O -fomit-frame-pointer" }
// { dg-options "-O -fomit-frame-pointer -mno-accumulate-outgoing-args" { target i?86-*-* } }
// { dg-do run }

void *sp;

void step (int)
{
  sp = __builtin_alloca (0);
}

void f2 (void)
{
  step (2);
  throw int();
}

void f1 (void)
{
  try
    {
      step (1);
      f2 ();
      step (-1);
    }
  catch (int)
    {
      step (3);
    }
}

int main ()
{
  f1 ();
  return 0;
}

"

-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19225



More information about the Gcc-bugs mailing list