diff options
Diffstat (limited to 'gcc-4.9/gcc/testsuite/g++.dg/ipa/pr63838.C')
-rw-r--r-- | gcc-4.9/gcc/testsuite/g++.dg/ipa/pr63838.C | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/ipa/pr63838.C b/gcc-4.9/gcc/testsuite/g++.dg/ipa/pr63838.C new file mode 100644 index 000000000..d67364900 --- /dev/null +++ b/gcc-4.9/gcc/testsuite/g++.dg/ipa/pr63838.C @@ -0,0 +1,56 @@ +// PR ipa/63838 +// { dg-do run } +// { dg-options "-O2 -fdump-ipa-pure-const" } +// { dg-final { scan-ipa-dump-not "Function found to be nothrow: void foo" "pure-const" } } +// { dg-final { scan-ipa-dump-not "Function found to be nothrow: void bar" "pure-const" } } +// { dg-final { cleanup-ipa-dump "pure-const" } } + +__attribute__((noinline, noclone)) static void bar (int); +volatile int v; +void (*fn) (); +struct S { S () { v++; } ~S () { v++; } }; + +__attribute__((noinline, noclone)) static void +foo (int x) +{ + v++; + if (x == 5) + bar (x); +} + +__attribute__((noinline, noclone)) static void +bar (int x) +{ + v++; + if (x == 6) + foo (x); + else if (x == 5) + fn (); +} + +__attribute__((noinline, noclone)) int +baz (int x) +{ + S s; + foo (x); +} + +void +throw0 () +{ + throw 0; +} + +int +main () +{ + fn = throw0; + asm volatile ("" : : : "memory"); + try + { + baz (5); + } + catch (int) + { + } +} |