summaryrefslogtreecommitdiff
path: root/libitm/testsuite/libitm.c++/eh-1.C
diff options
context:
space:
mode:
Diffstat (limited to 'libitm/testsuite/libitm.c++/eh-1.C')
-rw-r--r--libitm/testsuite/libitm.c++/eh-1.C36
1 files changed, 36 insertions, 0 deletions
diff --git a/libitm/testsuite/libitm.c++/eh-1.C b/libitm/testsuite/libitm.c++/eh-1.C
new file mode 100644
index 00000000000..49e2213e1ff
--- /dev/null
+++ b/libitm/testsuite/libitm.c++/eh-1.C
@@ -0,0 +1,36 @@
+// { dg-do run }
+
+extern "C" void abort ();
+
+int dothrow;
+int g;
+
+static void f1()
+{
+ g++;
+ if (dothrow)
+ throw 1;
+}
+
+static void f2()
+{
+ __transaction_atomic {
+ f1();
+ }
+}
+
+int main()
+{
+ dothrow = 0;
+ f2();
+
+ dothrow = 1;
+ try {
+ f2();
+ } catch (...) {
+ }
+
+ if (g != 2)
+ abort ();
+ return 0;
+}