1// PR optimization/12215
2// Origin: <nick@ilm.com>
3// Reduced testcase by Wolfgang Bangerth <bangerth@ticam.utexas.edu>
4
5// This used to fail because the CSE pass destroyed the CFG in presence
6// of trapping loads, which led to the deletion of basic blocks.
7
8// { dg-do compile }
9// { dg-options "-O2 -fno-gcse -fnon-call-exceptions" }
10
11
12struct B {
13  ~B() throw() {}
14};
15
16struct X {
17  X(const char*, const B&);
18  ~X() {}
19};
20
21bool m();
22void f(int &i, float &arg0);
23
24void g (const char **argv) {
25  float val;
26  int i = 1;
27
28  try {
29    while ( i < 1 )
30      {
31        X arg(argv[i], B());
32        if (m())
33          throw(0);
34
35        f(i, val);
36      }
37  } catch (...) {}
38}
39