gcc/testsuite/gcc.target/powerpc/safe-indirect-jump-4.c
raw| 1 | /* { dg-do run } */ |
| 2 | /* { dg-additional-options "-mno-speculate-indirect-jumps" } */ |
| 3 | /* { dg-warning "'-mno-speculate-indirect-jumps' is deprecated" "" { target *-*-* } 0 } */ |
| 4 | |
| 5 | /* Test for deliberate misprediction of indirect calls for ELFv2. */ |
| 6 | |
| 7 | int (*f)(); |
| 8 | |
| 9 | int __attribute__((noinline)) bar () |
| 10 | { |
| 11 | return (*f) (); |
| 12 | } |
| 13 | |
| 14 | int g () |
| 15 | { |
| 16 | return 26; |
| 17 | } |
| 18 | |
| 19 | int main () |
| 20 | { |
| 21 | f = &g; |
| 22 | if (bar () != 26) |
| 23 | __builtin_abort (); |
| 24 | |
| 25 | return 0; |
| 26 | } |