2015-09-24 Vladimir Makarov <vmakarov@redhat.com>
[official-gcc.git] / gcc / testsuite / gcc.dg / pr59963-2.c
blobea0594681a3df3e652627247cbff5f47ea4f9c2b
1 /* PR c/59963 */
2 /* { dg-do compile } */
3 /* { dg-options "-Woverflow -Wconversion" } */
5 extern void bar (unsigned char);
6 extern void bar8 (unsigned char, unsigned char, unsigned char, unsigned char,
7 unsigned char, unsigned char, unsigned char, unsigned char);
8 extern void bazu (unsigned int, ...);
9 extern void bazi (char, int);
10 extern int f (short a, short b);
12 int
13 g (void)
15 return f (0xffffffffL, /* { dg-warning "13:overflow in implicit constant conversion" } */
16 0xffffffffL) /* { dg-warning "13:overflow in implicit constant conversion" } */
17 && f (0xffffffffL, /* { dg-warning "9:overflow in implicit constant conversion" } */
18 0xffffffffL); /* { dg-warning "9:overflow in implicit constant conversion" } */
21 void
22 foo (int i)
24 bar (256); /* { dg-warning "8:large integer implicitly truncated to unsigned type" } */
25 bar (6.66f); /* { dg-warning "8:conversion" } */
26 bar8 (-1, /* { dg-warning "9:negative integer implicitly converted to unsigned type" } */
27 -2, /* { dg-warning "3:negative integer implicitly converted to unsigned type" } */
28 -3, /* { dg-warning "4:negative integer implicitly converted to unsigned type" } */
29 -4, /* { dg-warning "5:negative integer implicitly converted to unsigned type" } */
30 -5, /* { dg-warning "6:negative integer implicitly converted to unsigned type" } */
31 -6, /* { dg-warning "7:negative integer implicitly converted to unsigned type" } */
32 -7, /* { dg-warning "8:negative integer implicitly converted to unsigned type" } */
33 -8); /* { dg-warning "9:negative integer implicitly converted to unsigned type" } */
34 bazu (i, i); /* { dg-warning "9:conversion" } */
35 bazi (0x8, 0x80000000); /* { dg-warning "14:conversion of unsigned constant value to negative integer" } */