OSDN Git Service

* diagnostic.h (diagnostic_override_option_index): New macro to
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / gcc.dg / builtins-45.c
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
12 main ()
13 {
14   double nan = __builtin_nan ("");
15 #ifndef __SPU__
16   /* The SPU single-precision floating point format does not support NANs.  */
17   float nanf = __builtin_nanf ("");
18 #endif
19   long double nanl = __builtin_nanl ("");
20
21   double pinf = __builtin_inf ();
22 #ifndef __SPU__
23   /* The SPU single-precision floating point format does not support Inf.  */
24   float pinff = __builtin_inff ();
25 #endif
26   long double pinfl = __builtin_infl ();
27
28   if (__builtin_finite (pinf))
29     link_error ();
30 #ifndef __SPU__
31   if (__builtin_finitef (pinff))
32     link_error ();
33 #endif
34   if (__builtin_finitel (pinfl))
35     link_error ();
36
37   if (__builtin_finite (nan))
38     link_error ();
39 #ifndef __SPU__
40   if (__builtin_finitef (nanf))
41     link_error ();
42 #endif
43   if (__builtin_finitel (nanl))
44     link_error ();
45
46   if (!__builtin_finite (4.0))
47     link_error ();
48   if (!__builtin_finitef (4.0))
49     link_error ();
50   if (!__builtin_finitel (4.0))
51     link_error ();
52 }
53
54
55 /* Check that all instances of link_error were subject to DCE.  */
56 /* { dg-final { scan-tree-dump-times "link_error" 0 "optimized" } } */
57 /* { dg-final { cleanup-tree-dump "optimized" } } */