OSDN Git Service

Index: gcc/ChangeLog
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / gcc.dg / Wconversion-real.c
1 /* Test for diagnostics for Wconversion for floating-point.  */
2
3 /* { dg-do compile }
4 /* { dg-options "-std=c99 -Wconversion" } */
5
6 float  vfloat;
7 double vdouble;
8 long double vlongdouble;
9
10 void ffloat (float f);
11 void fdouble (double d);
12 void flongdouble (long double ld);
13
14 void h (void)
15 {
16   float f = 0;
17   double d = 0;
18   long double ld = 0;
19
20   ffloat (3.1); /* { dg-warning "conversion" } */
21   vfloat = 3.1; /* { dg-warning "conversion" } */
22   ffloat (3.1L); /* { dg-warning "conversion" } */
23   vfloat = 3.1L;  /* { dg-warning "conversion" } */
24   fdouble (3.1L); /* { dg-warning "conversion" "" { target large_long_double } } */
25   vdouble = 3.1L; /* { dg-warning "conversion" "" { target large_long_double } } */
26   ffloat (vdouble); /* { dg-warning "conversion" } */
27   vfloat = vdouble; /* { dg-warning "conversion" } */
28   ffloat (vlongdouble); /* { dg-warning "conversion" } */
29   vfloat = vlongdouble; /* { dg-warning "conversion" } */
30   fdouble (vlongdouble); /* { dg-warning "conversion" "" { target large_long_double } } */
31   vdouble = vlongdouble; /* { dg-warning "conversion" "" { target large_long_double } } */
32
33
34   ffloat ((float) 3.1); 
35   vfloat = (float) 3.1;
36   ffloat ((float) 3.1L);
37   vfloat = (float) 3.1L; 
38   fdouble ((double) 3.1L); 
39   vdouble = (double) 3.1L; 
40   ffloat ((float) vdouble); 
41   vfloat = (float) vdouble; 
42   ffloat ((float) vlongdouble); 
43   vfloat = (float) vlongdouble;
44   fdouble ((double) vlongdouble);
45   vdouble = (double) vlongdouble;
46
47
48   ffloat (3.0);
49   vfloat = 3.0;
50   ffloat (3.1f);
51   vfloat = 3.1f;
52   ffloat (0.25L);
53   vfloat = 0.25L;
54
55
56   fdouble (3.0);
57   vdouble = 3.0;
58   fdouble (3.1f);
59   vdouble = 3.1f;
60   fdouble (0.25L);
61   vdouble = 0.25L;
62
63   flongdouble (3.0);
64   vlongdouble = 3.0;
65   flongdouble (3.1f);
66   vlongdouble = 3.1f;
67   flongdouble (0.25L);
68   vlongdouble = 0.25L;
69
70   ffloat (f);
71   vfloat = f;
72   fdouble (f);
73   vdouble = f;
74   fdouble (d);
75   vdouble = d;
76   flongdouble (f);
77   vlongdouble = f;
78   flongdouble (d);
79   vlongdouble = d;
80   flongdouble (ld);
81   vlongdouble = ld;
82 }
83
84