PR target/37053
[official-gcc.git] / gcc / testsuite / gcc.dg / Wconversion-real.c
blobed7371b512321c010b1673cf7da24ec5c3a62bb9
1 /* Test for diagnostics for Wconversion for floating-point. */
3 /* { dg-do compile } */
4 /* { dg-skip-if "doubles are floats" { "avr-*-*" } { "*" } { "" } } */
5 /* { dg-options "-std=c99 -Wconversion" } */
6 /* { dg-require-effective-target large_double } */
8 float vfloat;
9 double vdouble;
10 long double vlongdouble;
12 void ffloat (float f);
13 void fdouble (double d);
14 void flongdouble (long double ld);
16 void h (void)
18 float f = 0;
19 double d = 0;
20 long double ld = 0;
22 ffloat (3.1); /* { dg-warning "conversion" } */
23 vfloat = 3.1; /* { dg-warning "conversion" } */
24 ffloat (3.1L); /* { dg-warning "conversion" } */
25 vfloat = 3.1L; /* { dg-warning "conversion" } */
26 fdouble (3.1L); /* { dg-warning "conversion" "" { target large_long_double } } */
27 vdouble = 3.1L; /* { dg-warning "conversion" "" { target large_long_double } } */
28 ffloat (vdouble); /* { dg-warning "conversion" } */
29 vfloat = vdouble; /* { dg-warning "conversion" } */
30 ffloat (vlongdouble); /* { dg-warning "conversion" } */
31 vfloat = vlongdouble; /* { dg-warning "conversion" } */
32 fdouble (vlongdouble); /* { dg-warning "conversion" "" { target large_long_double } } */
33 vdouble = vlongdouble; /* { dg-warning "conversion" "" { target large_long_double } } */
36 ffloat ((float) 3.1);
37 vfloat = (float) 3.1;
38 ffloat ((float) 3.1L);
39 vfloat = (float) 3.1L;
40 fdouble ((double) 3.1L);
41 vdouble = (double) 3.1L;
42 ffloat ((float) vdouble);
43 vfloat = (float) vdouble;
44 ffloat ((float) vlongdouble);
45 vfloat = (float) vlongdouble;
46 fdouble ((double) vlongdouble);
47 vdouble = (double) vlongdouble;
50 ffloat (3.0);
51 vfloat = 3.0;
52 ffloat (3.1f);
53 vfloat = 3.1f;
54 ffloat (0.25L);
55 vfloat = 0.25L;
58 fdouble (3.0);
59 vdouble = 3.0;
60 fdouble (3.1f);
61 vdouble = 3.1f;
62 fdouble (0.25L);
63 vdouble = 0.25L;
65 flongdouble (3.0);
66 vlongdouble = 3.0;
67 flongdouble (3.1f);
68 vlongdouble = 3.1f;
69 flongdouble (0.25L);
70 vlongdouble = 0.25L;
72 ffloat (f);
73 vfloat = f;
74 fdouble (f);
75 vdouble = f;
76 fdouble (d);
77 vdouble = d;
78 flongdouble (f);
79 vlongdouble = f;
80 flongdouble (d);
81 vlongdouble = d;
82 flongdouble (ld);
83 vlongdouble = ld;