aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/tree-ssa/range-sqrt.c
blob: d2a2626add3db3c3347cb44e644ead0aedc4b417 (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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
// { dg-do compile }
// { dg-options "-O2 -fdump-tree-evrp -fno-thread-jumps" }

#include <math.h>

void use (double);
void link_error ();

void
foo (double x)
{
  if (__builtin_isnan (x))
    __builtin_unreachable ();
  x = sqrt (x);
  if (x < -0.0)
    link_error ();
  use (x);
}

void
bar (double x)
{
  if (!__builtin_isnan (sqrt (x)))
    {
      if (__builtin_isnan (x))
	link_error ();
      if (x < -0.0)
	link_error ();
    }
}

void
stool (double x)
{
  double res1 = sqrt (x);
  double res2 = __builtin_sqrt (x);
  if (res1 < -0.0 || res2 < -0.0)
    link_error ();
}

// { dg-final { scan-tree-dump-not "link_error" "evrp" { target { { *-*-linux* } && { glibc } } } } }