]> gcc.gnu.org Git - gcc.git/commitdiff
re PR c++/6764 (Throwing exception causes crash with '-O2 -fomit-frame-pointer')
authorRichard Henderson <rth@redhat.com>
Fri, 26 Nov 2004 02:04:11 +0000 (18:04 -0800)
committerRichard Henderson <rth@gcc.gnu.org>
Fri, 26 Nov 2004 02:04:11 +0000 (18:04 -0800)
        PR c++/6764
        * reload1.c (set_initial_eh_label_offset): New.
        (set_initial_label_offsets): Use it.

From-SVN: r91318

gcc/ChangeLog
gcc/reload1.c
gcc/testsuite/g++.dg/opt/eh2.C [new file with mode: 0644]

index 8358ecf4647359e2e325cd628d98b4536c3c6ad7..c4f82e3584b3dcb9eed921a55f0bdd4ea9b1a3ac 100644 (file)
@@ -1,3 +1,9 @@
+2004-11-25  Ricahrd Henderson  <rth@redhat.com>
+
+       PR c++/6764
+        * reload1.c (set_initial_eh_label_offset): New.
+        (set_initial_label_offsets): Use it.
+
 2004-11-25  Kaz Kojima  <kkojima@gcc.gnu.org>
 
        * config/sh/sh.c (sh_output_mi_thunk): Initialize bitmap obstacks
index 9ffa798e1cf210345b357cc5657756e103a1ade4..c90c8b61eea36796092f255eaa5aceac641f8f2f 100644 (file)
@@ -3316,6 +3316,14 @@ set_initial_elim_offsets (void)
   num_not_at_initial_offset = 0;
 }
 
+/* Subroutine of set_initial_label_offsets called via for_each_eh_label.  */
+
+static void
+set_initial_eh_label_offset (rtx label)
+{
+  set_label_offsets (label, NULL_RTX, 1);
+}
+
 /* Initialize the known label offsets.
    Set a known offset for each forced label to be at the initial offset
    of each elimination.  We do this because we assume that all
@@ -3332,6 +3340,8 @@ set_initial_label_offsets (void)
   for (x = forced_labels; x; x = XEXP (x, 1))
     if (XEXP (x, 0))
       set_label_offsets (XEXP (x, 0), NULL_RTX, 1);
+
+  for_each_eh_label (set_initial_eh_label_offset);
 }
 
 /* Set all elimination offsets to the known values for the code label given
diff --git a/gcc/testsuite/g++.dg/opt/eh2.C b/gcc/testsuite/g++.dg/opt/eh2.C
new file mode 100644 (file)
index 0000000..7cb49f0
--- /dev/null
@@ -0,0 +1,34 @@
+// PR 6764
+// { dg-do run }
+// { dg-options "-O -fomit-frame-pointer" }
+
+extern "C" void abort ();
+
+class test
+{
+ public:
+  test * const me;
+  test () : me(this) { }
+  ~test () { if (me != this) abort (); }
+};
+
+void x1 ()
+{
+  test w1;
+  throw 1;
+}
+
+void x2 ()
+{
+  test w2;
+  x1 ();
+}
+
+int main (void)
+{
+  try {
+    x2 ();
+  } catch (...) {
+  }
+  return 0;
+}
This page took 0.089389 seconds and 5 git commands to generate.