summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/fixed-point/int-warning.c
blob: 14adcc7221d2388fbfda468e22c28a2603afba22 (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 conversion" } */
  sc = -500k; /* { dg-warning "overflow in conversion" } */
  sc = 500lk; /* { dg-warning "overflow in conversion" } */
  sc = -500lk; /* { dg-warning "overflow in conversion" } */
  sc = 500llk; /* { dg-warning "overflow in conversion" } */
  sc = -500llk; /* { dg-warning "overflow in conversion" } */
  uc = 500k; /* { dg-warning "overflow in conversion" } */
  uc = -500k; /* { dg-warning "overflow in conversion" } */
  uc = 500lk; /* { dg-warning "overflow in conversion" } */
  uc = -500lk; /* { dg-warning "overflow in conversion" } */
  uc = 500llk; /* { dg-warning "overflow in conversion" } */
  uc = -500llk; /* { dg-warning "overflow in conversion" } */
}