OSDN Git Service

Test case for PR target/18841.
authorrth <rth@138bc75d-0d04-0410-961f-82ee72b054a4>
Sun, 5 Dec 2004 20:07:09 +0000 (20:07 +0000)
committerrth <rth@138bc75d-0d04-0410-961f-82ee72b054a4>
Sun, 5 Dec 2004 20:07:09 +0000 (20:07 +0000)
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@91756 138bc75d-0d04-0410-961f-82ee72b054a4

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

diff --git a/gcc/testsuite/g++.dg/opt/eh3.C b/gcc/testsuite/g++.dg/opt/eh3.C
new file mode 100644 (file)
index 0000000..0cd9cac
--- /dev/null
@@ -0,0 +1,33 @@
+// PR target/18841
+// { dg-do run }
+// { dg-options "-O2" }
+
+extern "C" void abort ();
+
+int r, i1 = 1, i2 = 2, i3 = 3, i4 = 4, i5 = 5;
+
+struct S
+{
+  ~S() { r = i1 + i2 + i3 + i4 + i5; }
+};
+
+void foo()
+{
+  S s;
+  throw 1;
+}
+
+void bar()
+{
+  try {
+    foo();
+  } catch (...) {
+  }
+}
+
+int main()
+{
+  bar();
+  if (r != 1 + 2 + 3 + 4 + 5)
+    abort ();
+}