gcc/testsuite/gcc.dg/tree-prof/pr49299-1.c
raw| 1 | /* { dg-options "-O2" } */ |
| 2 | |
| 3 | __attribute__((noreturn)) void (*fn) (void); |
| 4 | |
| 5 | volatile int v; |
| 6 | |
| 7 | __attribute__((noreturn)) void |
| 8 | fn0 (void) |
| 9 | { |
| 10 | __builtin_exit (0); |
| 11 | } |
| 12 | |
| 13 | __attribute__((noreturn)) void |
| 14 | fn1 (void) |
| 15 | { |
| 16 | __builtin_exit (1); |
| 17 | } |
| 18 | |
| 19 | __attribute__((noinline, noclone)) void |
| 20 | setfn (__attribute__((noreturn)) void (*x) (void)) |
| 21 | { |
| 22 | fn = x; |
| 23 | } |
| 24 | |
| 25 | int |
| 26 | main () |
| 27 | { |
| 28 | int i; |
| 29 | if (v < 1) |
| 30 | setfn (fn0); |
| 31 | else |
| 32 | setfn (fn1); |
| 33 | fn (); |
| 34 | } |