1 /* Test for diagnostics for Wconversion between floating-point and
5 /* { dg-skip-if "doubles are floats,ints are 16bits" { "avr-*-*" } { "*" } { "" } } */
6 /* { dg-options "-std=c99 -Wconversion" } */
7 /* { dg-require-effective-target int32plus } */
8 /* { dg-require-effective-target double64plus } */
11 void fsi (signed int x
);
12 void fui (unsigned int x
);
13 void ffloat (float x
);
14 void fdouble (double x
);
28 fsi (3.1f
); /* { dg-warning "conversion" } */
29 si
= 3.1f
; /* { dg-warning "conversion" } */
30 fsi (3.1); /* { dg-warning "conversion" } */
31 si
= 3.1; /* { dg-warning "conversion" } */
32 fsi (d
); /* { dg-warning "conversion" } */
33 si
= d
; /* { dg-warning "conversion" } */
34 fui (-1.0); /* { dg-warning "overflow" } */
35 ui
= -1.0; /* { dg-warning "overflow" } */
36 ffloat (INT_MAX
); /* { dg-warning "conversion" } */
37 vfloat
= INT_MAX
; /* { dg-warning "conversion" } */
38 ffloat (16777217); /* { dg-warning "conversion" } */
39 vfloat
= 16777217; /* { dg-warning "conversion" } */
40 ffloat (si
); /* { dg-warning "conversion" } */
41 vfloat
= si
; /* { dg-warning "conversion" } */
42 ffloat (ui
); /* { dg-warning "conversion" } */
43 vfloat
= ui
; /* { dg-warning "conversion" } */
75 void fss (signed short x
);
76 void fus (unsigned short x
);
77 void fsc (signed char x
);
78 void fuc (unsigned char x
);
82 unsigned short int us
;
87 fss (4294967294.0); /* { dg-warning "conversion" } */
88 ss
= 4294967294.0; /* { dg-warning "conversion" } */
89 fss (-4294967294.0); /* { dg-warning "conversion" } */
90 ss
= -4294967294.0; /* { dg-warning "conversion" } */
91 fus (4294967294.0); /* { dg-warning "conversion" } */
92 us
= 4294967294.0; /* { dg-warning "conversion" } */
93 fus (-4294967294.0); /* { dg-warning "conversion" } */
94 us
= -4294967294.0; /* { dg-warning "conversion" } */
96 fsc (500.0); /* { dg-warning "conversion" } */
97 sc
= 500.0; /* { dg-warning "conversion" } */
98 fsc (-500.0); /* { dg-warning "conversion" } */
99 sc
= -500.0; /* { dg-warning "conversion" } */
100 fuc (500.0); /* { dg-warning "conversion" } */
101 uc
= 500.0; /* { dg-warning "conversion" } */
102 fuc (-500.0); /* { dg-warning "conversion" } */
103 uc
= -500.0; /* { dg-warning "conversion" } */
111 fus (-500.0); /* { dg-warning "conversion" } */
112 us
= -500.0; /* { dg-warning "conversion" } */