OSDN Git Service

PR rtl-optimization/52139
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / gcc.dg / dfp / pragma-float-const-decimal64-7.c
1 /* { dg-do compile } */
2 /* { dg-options "-Wall" } */
3
4 /* N1312 7.1.1: The FLOAT_CONST_DECIMAL64 pragma.
5    C99 6.4.4.2a (New).
6
7    Check that when pragma FLOAT_CONST_DECIMAL64 is in effect so that
8    unsuffixed constants are _Decimal64, invalid types are still reported
9    as invalid.  */
10
11 double
12 f1 (void)
13 {
14 #pragma STDC FLOAT_CONST_DECIMAL64 OFF
15   double a = 0x1.0p1;
16   double b = 1.0i;
17
18   return a + b;
19 }
20
21 double
22 f2 (void)
23 {
24 #pragma STDC FLOAT_CONST_DECIMAL64 OFF
25   double a = 0x1.0p1dd;         /* { dg-error "with hex" } */
26   double b = 1.0idd;            /* { dg-error "invalid suffix" } */
27
28   return a + b;
29 }
30
31 double
32 f3 (void)
33 {
34 #pragma STDC FLOAT_CONST_DECIMAL64 ON
35   double a = 0x1.0p1;   /* Hex constant is not affected by pragma.  */
36   double b = 1.0i;      /* Imaginary constant is not affected by pragma.  */
37
38   return a + b;
39 }