Home | History | Annotate | Download | only in jni
      1 // Derived from PR22167, which failed on some RISC targets.  The call to
      2 // foo() has two successors, one normal and one exceptional, and both
      3 // successors use &a[0] and x.  Expressions involving &a[0] can be hoisted
      4 // before the call but those involving x cannot.
      5 // { dg-options "-Os" }
      6 // { dg-do run }
      7 
      8 int a[4];
      9 
     10 struct S {
     11   S() : x (0) {}
     12   ~S() { a[0] = x; }
     13   int x;
     14 };
     15 
     16 void
     17 foo (int *x)
     18 {
     19   if (*x == 1)
     20     throw 1;
     21   *x = 1;
     22 }
     23 
     24 int
     25 main()
     26 {
     27   S s;
     28   foo (&s.x);
     29   if (a[0] == s.x)
     30     a[0]++;
     31   return a[0];
     32 }
     33