aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.c-torture/execute/pr107879.c
blob: 2aabe8e3a0cfda4c47431d61ab6fb2299494ab6a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
/* PR tree-optimization/107879 */

__attribute__((noipa)) static double
foo (double *y)
{
  volatile int ph = 0;
  volatile double vf = 1.0;
  double factor = vf;
  double x = - (double) ph * factor;
  if (x == 0)
    *y = 1.0;
  else
    *y = 1.0 / x;
  double w = 2.0 * x / factor;
  double omww = 1 - w;
  return omww > 0.0 ? omww : 0.0;
}

int
main ()
{
  double y = 42.0;
  if (foo (&y) != 1.0)
    __builtin_abort ();
}