summaryrefslogtreecommitdiffstats
path: root/libitm/testsuite/libitm.c++/eh-1.C
blob: 49e2213e1ff9d508802615309c961b0d447b9a5d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
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;
}
OpenPOWER on IntegriCloud