re PR tree-optimization/51117 (rev.181172 causes glibc build failure)
authorJakub Jelinek <jakub@redhat.com>
Thu, 15 Dec 2011 17:27:08 +0000 (18:27 +0100)
committerJakub Jelinek <jakub@gcc.gnu.org>
Thu, 15 Dec 2011 17:27:08 +0000 (18:27 +0100)
PR tree-optimization/51117
* g++.dg/opt/pr51117.C: New test.

From-SVN: r182379

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

index 14d888a85807b1cabb09a1cce3a9268e7e4d3688..392aa37fa69a82345f0e54e76d18b6f7443a97ec 100644 (file)
@@ -1,3 +1,8 @@
+2011-12-15  Jakub Jelinek  <jakub@redhat.com>
+
+       PR tree-optimization/51117
+       * g++.dg/opt/pr51117.C: New test.
+
 2011-12-15  Romain Geissler  <romain.geissler@gmail.com>
 
        * gcc.c-torture/execute/builtins/chk.h (stpncpy, stpncpy_disallowed):
diff --git a/gcc/testsuite/g++.dg/opt/pr51117.C b/gcc/testsuite/g++.dg/opt/pr51117.C
new file mode 100644 (file)
index 0000000..b5fec03
--- /dev/null
@@ -0,0 +1,37 @@
+// PR tree-optimization/51117
+// { dg-do compile }
+// { dg-options "-O2 -fexceptions" }
+
+struct A { char buf[64]; };
+void bar (A *);
+
+int
+foo ()
+{
+  A c;
+  bar (&c);
+  try
+  {
+    {
+      A a;
+      bar (&a);
+      if (a.buf[13])
+        throw 1;
+      else if (a.buf[52])
+        throw 3;
+    }
+    {
+      A b;
+      bar (&b);
+      if (b.buf[13])
+        throw 2;
+    }
+  }
+  catch ( ...)
+  {
+    return 1;
+  }
+  return 0;
+}
+
+// { dg-final { scan-assembler-not "__cxa_rethrow" } }