g++.eh/unwind1.C

Mark Mitchell mark@codesourcery.com
Tue Apr 27 00:10:00 GMT 1999


This test is failing for me on x86-linux-gnu.  It's possible *I* broke
it, but I don't think so; I've got a compiler with most of my recent
changes in that works.  The problem is that the EH tables contain
wrong information about where to put the stack pointer;
coincidentally, the amount by which they're off is, I think, the size
of the stack frame for the function.  I'm wondering if the recent
leaf-function changes could have had something to do with this?

Here's the code that fails.

-- 
Mark Mitchell                   mark@codesourcery.com
CodeSourcery, LLC               http://www.codesourcery.com

--

// Test that unwinding properly restores SP.
// Contributed by Jason Merrill <jason@cygnus.com>

int f (int i)
{
  throw i;
}

int main ()
{  
  void *sp1 = __builtin_alloca (0);

  try
    {
      f (0);
    }
  catch (int)
    {
    }

  void *sp2 = __builtin_alloca (0);

  return (sp1 != sp2);
}


More information about the Gcc-bugs mailing list