PR testsuite/52641
[official-gcc.git] / gcc / testsuite / gcc.dg / tree-ssa / pr23234.c
blob3a3869815c8b6236b5562b3c853232992bde9800
1 /* The problem in this PR was mostly finding a suitable place to insert
2 the reciprocals of the function arguments. This test case tries to
3 test three possible ways of how this may go wrong. */
4 /* { dg-options "-O2 -ffast-math" } */
5 /* { dg-do compile } */
7 /* The original test case. */
8 double
9 f1 (double a, double b, double c)
11 double y0;
12 double y1;
14 if (a == 0.0)
16 y0 = -c / b;
17 return y0;
19 y0 = c / b;
20 y1 = a / b;
21 return y0 * y1;
24 /* Labels may end up in the middle of a block. Also bad. */
25 double
26 f2 (double a, double b, double c)
28 double y0;
29 double y1;
31 a_label:
32 another_label:
33 if (a == 0.0)
35 y0 = -c / b;
36 return y0;
38 y0 = c / b;
39 y1 = a / b;
40 return y0 * y1;
43 /* Uses must still be dominated by their defs. */
44 double
45 f3 (double a, double b, double c)
47 double y0;
48 double y1;
50 y0 = -c / b;
51 if (a == 0.0)
53 return y0;
55 y0 = c / b;
56 y1 = a / b;
57 return y0 * y1;