1 /* { dg-do compile } */
2 /* { dg-options "-O1 -fno-trapping-math -fno-finite-math-only -fdump-tree-optimized" } */
3 
4 extern void f(int);
5 extern void link_error ();
6 
7 extern float x;
8 extern double y;
9 extern long double z;
10 
11 int
main()12 main ()
13 {
14   double pinf = __builtin_inf ();
15 #ifndef __SPU__
16   /* The SPU single-precision floating point format does not support Inf.  */
17   float pinff = __builtin_inff ();
18 #endif
19   long double pinfl = __builtin_infl ();
20 
21   if (__builtin_isinf (pinf) != 1)
22     link_error ();
23 #ifndef __SPU__
24   if (__builtin_isinf (pinff) != 1)
25     link_error ();
26   if (__builtin_isinff (pinff) != 1)
27     link_error ();
28 #endif
29   if (__builtin_isinf (pinfl) != 1)
30     link_error ();
31   if (__builtin_isinfl (pinfl) != 1)
32     link_error ();
33 
34   if (__builtin_isinf_sign (-pinf) != -1)
35     link_error ();
36 #ifndef __SPU__
37   if (__builtin_isinf_sign (-pinff) != -1)
38     link_error ();
39 #endif
40   if (__builtin_isinf_sign (-pinfl) != -1)
41     link_error ();
42 
43   if (__builtin_isinf (4.0))
44     link_error ();
45   if (__builtin_isinf (4.0))
46     link_error ();
47   if (__builtin_isinff (4.0))
48     link_error ();
49   if (__builtin_isinf (4.0))
50     link_error ();
51   if (__builtin_isinfl (4.0))
52     link_error ();
53 }
54 
55 
56 /* Check that all instances of link_error were subject to DCE.  */
57 /* { dg-final { scan-tree-dump-times "link_error" 0 "optimized" } } */
58