gcc/testsuite/gcc.c-torture/execute/pr68390.c
raw| 1 | /* { dg-do run } */ |
| 2 | /* { dg-options "-O2" } */ |
| 3 | |
| 4 | __attribute__ ((noinline)) |
| 5 | double direct(int x, ...) |
| 6 | { |
| 7 | return x*x; |
| 8 | } |
| 9 | |
| 10 | __attribute__ ((noinline)) |
| 11 | double broken(double (*indirect)(int x, ...), int v) |
| 12 | { |
| 13 | return indirect(v); |
| 14 | } |
| 15 | |
| 16 | int main () |
| 17 | { |
| 18 | double d1, d2; |
| 19 | int i = 2; |
| 20 | d1 = broken (direct, i); |
| 21 | if (d1 != i*i) |
| 22 | { |
| 23 | __builtin_abort (); |
| 24 | } |
| 25 | return 0; |
| 26 | } |
| 27 |