summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/fixed-point/int-warning.c
blob: cf48e4ba2b3f0fe6743725e797ccb962c1afaf21 (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
/* { dg-do compile } */
/* { dg-options "-std=gnu99 -O2" } */

/* N1169 Conversion from fixed-point to integer.
   Test if GCC warns when overflow or underflow.  */

signed char sc;
unsigned char uc;

void test()
{
  sc = 500k; /* { dg-warning "overflow in implicit constant conversion" } */
  sc = -500k; /* { dg-warning "overflow in implicit constant conversion" } */
  sc = 500lk; /* { dg-warning "overflow in implicit constant conversion" } */
  sc = -500lk; /* { dg-warning "overflow in implicit constant conversion" } */
  sc = 500llk; /* { dg-warning "overflow in implicit constant conversion" } */
  sc = -500llk; /* { dg-warning "overflow in implicit constant conversion" } */
  uc = 500k; /* { dg-warning "overflow in implicit constant conversion" } */
  uc = -500k; /* { dg-warning "overflow in implicit constant conversion" } */
  uc = 500lk; /* { dg-warning "overflow in implicit constant conversion" } */
  uc = -500lk; /* { dg-warning "overflow in implicit constant conversion" } */
  uc = 500llk; /* { dg-warning "overflow in implicit constant conversion" } */
  uc = -500llk; /* { dg-warning "overflow in implicit constant conversion" } */
}