[testcase] c++/5246: g++ 3.0.3: exception throw crash when -O -fomit-frame-pointer

Gwenole Beauchesne gbeauchesne@mandrakesoft.com
Wed Jan 2 11:23:00 GMT 2002


On 2 Jan 2002 eru@netti.fi wrote:

> This is a re-report of my earlier problem report 4955 for GCC 3.0.2, which was
> marked closed, but the problem seems to persist in GCC 3.0.3.
> Exception throwing through multiple levels of catch+throw
> crashes, if the combination of some -O option and -fomit-frame-pointer
> is used. Either alone works. A short self-contained test program attached.

Here is a testcase derived from PR c++/5246 and PR c++/2447.  Problem
reproduced with FSF gcc 3.0.3 and binutils 2.11.92.0.12-2mdk (based on RH
binutils 2.11.92.0.12-8). Can't reproduce with mainline (3.1 20020102).

PS: Sorry, that's probably not the ideal file test name and location.

2002-01-02  Gwenole Beauchesne  <gbeauchesne@mandrakesoft.com>

	PR c++/5246, PR c++/2447
	* g++.old-deja/g++.eh/unwind2.C: New test.

--- gcc/testsuite/g++.old-deja/g++.eh/unwind2.C.eh-failure	Wed Jan  2 18:54:56 2002
+++ gcc/testsuite/g++.old-deja/g++.eh/unwind2.C	Wed Jan  2 18:54:03 2002
@@ -0,0 +1,33 @@
+// Reduced from PR c++/5246, PR c++/2447
+// Special g++ Options: -O -fomit-frame-pointer
+
+void step (int)
+{
+  void *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;
+}




More information about the Gcc-patches mailing list