gcc/testsuite/gcc.c-torture/execute/ieee/acc2.c
raw| 1 | /* Tail call optimizations would reverse the order of multiplications |
| 2 | in func(). */ |
| 3 | |
| 4 | void abort (void); |
| 5 | void exit (int); |
| 6 | |
| 7 | double func (const double *array) |
| 8 | { |
| 9 | double d = *array; |
| 10 | if (d == 1.0) |
| 11 | return d; |
| 12 | else |
| 13 | return d * func (array + 1); |
| 14 | } |
| 15 | |
| 16 | int main () |
| 17 | { |
| 18 | double values[] = { __DBL_MAX__, 2.0, 0.5, 1.0 }; |
| 19 | if (func (values) != __DBL_MAX__) |
| 20 | abort (); |
| 21 | exit (0); |
| 22 | } |