view libitm/testsuite/libitm.c++/eh-1.C @ 158:494b0b89df80 default tip

...
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Mon, 25 May 2020 18:13:55 +0900
parents 04ced10e8804
children
line wrap: on
line source

// { 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;
}