| 1 |
// PR ipa/63838 |
| 2 |
// { dg-do run } |
| 3 |
// { dg-options "-O2 -fdump-ipa-pure-const" } |
| 4 |
// { dg-final { scan-ipa-dump-not "Function found to be nothrow: void foo" "pure-const" } } |
| 5 |
// { dg-final { scan-ipa-dump-not "Function found to be nothrow: void bar" "pure-const" } } |
| 6 |
|
| 7 |
__attribute__((noinline, noclone)) static void bar (int); |
| 8 |
volatile int v; |
| 9 |
void (*fn) (); |
| 10 |
struct S { S () { v++; } ~S () { v++; } }; // { dg-warning "deprecated" "" { target c++2a } } |
| 11 |
|
| 12 |
__attribute__((noinline, noclone)) static void |
| 13 |
foo (int x) |
| 14 |
{ |
| 15 |
v++; // { dg-warning "deprecated" "" { target c++2a } } |
| 16 |
if (x == 5) |
| 17 |
bar (x); |
| 18 |
} |
| 19 |
|
| 20 |
__attribute__((noinline, noclone)) static void |
| 21 |
bar (int x) |
| 22 |
{ |
| 23 |
v++; // { dg-warning "deprecated" "" { target c++2a } } |
| 24 |
if (x == 6) |
| 25 |
foo (x); |
| 26 |
else if (x == 5) |
| 27 |
fn (); |
| 28 |
} |
| 29 |
|
| 30 |
__attribute__((noinline, noclone)) void |
| 31 |
baz (int x) |
| 32 |
{ |
| 33 |
S s; |
| 34 |
foo (x); |
| 35 |
} |
| 36 |
|
| 37 |
void |
| 38 |
throw0 () |
| 39 |
{ |
| 40 |
throw 0; |
| 41 |
} |
| 42 |
|
| 43 |
int |
| 44 |
main () |
| 45 |
{ |
| 46 |
fn = throw0; |
| 47 |
asm volatile ("" : : : "memory"); |
| 48 |
try |
| 49 |
{ |
| 50 |
baz (5); |
| 51 |
} |
| 52 |
catch (int) |
| 53 |
{ |
| 54 |
} |
| 55 |
} |