| 1 |
// { dg-do run } |
| 2 |
// { dg-additional-options "-ffast-math" } |
| 3 |
|
| 4 |
double a1 = 1.0; |
| 5 |
double a2 = 1.0; |
| 6 |
|
| 7 |
void __attribute__((noipa)) |
| 8 |
f(double K[2], bool b) |
| 9 |
{ |
| 10 |
double A[] = { |
| 11 |
b ? a1 : a2, |
| 12 |
0, |
| 13 |
0, |
| 14 |
0 |
| 15 |
}; |
| 16 |
|
| 17 |
double sum{}; |
| 18 |
for(double a : A) sum += a; |
| 19 |
for(double& a : A) a /= sum; |
| 20 |
|
| 21 |
if (b) { |
| 22 |
K[0] = A[0]; // 1.0 |
| 23 |
K[1] = A[1]; // 0.0 |
| 24 |
} else { |
| 25 |
K[0] = A[0] + A[1]; |
| 26 |
} |
| 27 |
} |
| 28 |
|
| 29 |
int main() |
| 30 |
{ |
| 31 |
double K[2]{}; |
| 32 |
f(K, true); |
| 33 |
if (K[0] != 1. || K[1] != 0.) |
| 34 |
__builtin_abort (); |
| 35 |
} |