PR middle-end/27945
[official-gcc.git] / gcc / testsuite / gcc.dg / builtins-44.c
blobb3916886a43c202f7e7d7988e027d461465ac8fe
1 /* { dg-do compile } */
2 /* { dg-options "-O1 -fno-trapping-math -fno-finite-math-only -fdump-tree-optimized" } */
4 extern void f(int);
5 extern void link_error ();
7 extern float x;
8 extern double y;
9 extern long double z;
11 int
12 main ()
14 double pinf = __builtin_inf ();
15 float pinff = __builtin_inff ();
16 long double pinfl = __builtin_infl ();
18 if (__builtin_isinf (pinf) != 1)
19 link_error ();
20 if (__builtin_isinf (pinff) != 1)
21 link_error ();
22 if (__builtin_isinff (pinff) != 1)
23 link_error ();
24 if (__builtin_isinf (pinfl) != 1)
25 link_error ();
26 if (__builtin_isinfl (pinfl) != 1)
27 link_error ();
29 if (__builtin_isinf (-pinf) != -1)
30 link_error ();
31 if (__builtin_isinf (-pinff) != -1)
32 link_error ();
33 if (__builtin_isinff (-pinff) != -1)
34 link_error ();
35 if (__builtin_isinf (-pinfl) != -1)
36 link_error ();
37 if (__builtin_isinfl (-pinfl) != -1)
38 link_error ();
40 if (__builtin_isinf (4.0))
41 link_error ();
42 if (__builtin_isinf (4.0))
43 link_error ();
44 if (__builtin_isinff (4.0))
45 link_error ();
46 if (__builtin_isinf (4.0))
47 link_error ();
48 if (__builtin_isinfl (4.0))
49 link_error ();
53 /* Check that all instances of link_error were subject to DCE. */
54 /* { dg-final { scan-tree-dump-times "link_error" 0 "optimized" } } */
55 /* { dg-final { cleanup-tree-dump "optimized" } } */