aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/gcc.dg/pr59940.c
blob: b0fd17f50cbec78044fc628e16b2c785898a5ee5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
/* PR c/59940 */
/* { dg-do compile } */
/* { dg-options "-Wconversion -Woverflow" } */

int f (unsigned int);

int
g (void)
{
  int si = 12;
  unsigned int ui = -1; /* { dg-warning "21:negative integer implicitly converted to unsigned type" } */
  unsigned char uc;
  ui = si; /* { dg-warning "8:conversion" } */
  si = 0x80000000; /* { dg-warning "8:conversion of unsigned constant value to negative integer" } */
  si = 3.2f; /* { dg-warning "8:conversion" } */
  uc = 256; /* { dg-warning "8:large integer implicitly truncated to unsigned type" } */
  si = 0x800000000; /* { dg-warning "8:overflow in implicit constant conversion" } */
  return f (si) /* { dg-warning "13:conversion" } */
         + f (si); /* { dg-warning "15:conversion" } */
}

int
y (void)
{
  f (); /* { dg-error "3:too few arguments to function" } */
  g (0xa); /* { dg-error "3:too many arguments to function" } */
}