summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/switch-warn-2.c
blob: ab742669163f941524bc8912985238fe37327e75 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
/* This should not warn about the case label being out of range.  */
/* { dg-do run } */
/* { dg-options "-O0" } */

int
foo (unsigned int i)
{
  switch (i)
  {
    case 123456123456ULL: /* { dg-warning "large integer implicitly truncated to unsigned type" } */
      return 0;
    default:
      return 3;
  }
}

int
main (void)
{
  if (foo (10) != 3)
    abort ();
  exit (0);
}