OSDN Git Service

Latest updates from FSF 4.7 branch
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / c-c++-common / pr41779.c
1 /* PR41779: Wconversion cannot see throught real*integer promotions. */
2 /* { dg-do compile { target int32plus } } */
3 /* { dg-skip-if "doubles are floats" { "avr-*-*" "xstormy16-*-*" } { "*" } { "" } } */
4 /* { dg-options "-std=c99 -Wconversion" { target c } } */
5 /* { dg-options "-Wconversion" { target c++ } } */
6 /* { dg-require-effective-target large_double } */
7
8 float f1(float x, unsigned short y)
9 {
10   return x * y;
11 }
12
13 float f2(float x, short y)
14 {
15   return x * y;
16 }
17
18 float f3(float x, char y)
19 {
20   return x * y;
21 }
22
23 float f4(float x, unsigned char y)
24 {
25   return x * y;
26 }
27
28 float f5(float x, int y)
29 {
30   return x * y; /* { dg-warning "conversion" } */
31 }
32
33 double c1(float x, unsigned short y, int z)
34 {
35   return z ? x + x : y;
36 }
37
38 double c2(float x, short y, int z)
39 {
40   return z ? x + x : y;
41 }
42
43 double c3(float x, char y, int z)
44 {
45   return z ? x + x : y;
46 }
47
48 double c4(float x, unsigned char y, int z)
49 {
50   return z ? x + x : y;
51 }
52
53 double c5(float x, int y, int z)
54 {
55   return z ? x + x : y; /* { dg-warning "conversion" } */
56 }