(root)/
gcc-13.2.0/
gcc/
testsuite/
g++.dg/
torture/
pr100382.C
// { dg-do run }
// { dg-additional-options -fno-delete-dead-exceptions }

int x, y;
int __attribute__((pure,noinline)) foo () { if (x) throw 1; return y; }

int __attribute__((noinline)) bar()
{
  int a[2];
  x = 1;
  try {
    int res = foo ();
    a[0] = res;
  } catch (...) {
      return 0;
  }
  return 1;
}

int main()
{
  if (bar ())
    __builtin_abort ();
  return 0;
}