This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/20581] Incorrect codegen for exceptions
- From: "dalej at apple dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 21 Mar 2005 21:49:15 -0000
- Subject: [Bug c++/20581] Incorrect codegen for exceptions
- References: <20050321214213.20581.dalej@apple.com>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Additional Comments From dalej at apple dot com 2005-03-21 21:49 -------
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=20581