aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/opt/cfg2.C
blob: 229f4bc3a527d0dfa23d6a1ba073468c172d5ab2 (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
37
38
// PR optimization/12215
// Origin: <nick@ilm.com>
// Reduced testcase by Wolfgang Bangerth <bangerth@ticam.utexas.edu>

// This used to fail because the CSE pass destroyed the CFG in presence
// of trapping loads, which led to the deletion of basic blocks.

// { dg-do compile }
// { dg-options "-O2 -fno-gcse -fnon-call-exceptions" }


struct B {
  ~B() throw() {}
};

struct X {
  X(const char*, const B&);
  ~X() {}
};

bool m();
void f(int &i, float &arg0);

void g (const char **argv) {
  float val;
  int i = 1;

  try {
    while ( i < 1 )
      {
        X arg(argv[i], B());
        if (m())
          throw(0);

        f(i, val);
      }
  } catch (...) {}
}