2018-03-08 Richard Biener <rguenther@suse.de>
[official-gcc.git] / gcc / testsuite / gcc.dg / Wswitch-unreachable-1.c
blob2e5c99bce3c578426fcefb44fa864152f7d843e7
1 /* PR c/49859 */
2 /* { dg-do compile } */
3 /* { dg-options "-Wswitch-unreachable" } */
5 extern void foo (int);
6 extern int j;
8 void
9 fn0 (int i)
11 switch (i)
13 int t = 10; /* { dg-warning "statement will never be executed" } */
14 default:
15 foo (t);
18 switch (i)
19 { /* { dg-warning "statement will never be executed" } */
20 int A[i];
21 default: /* { dg-error "switch jumps into scope" } */
22 break;
25 switch (i)
26 default:
27 j = sizeof (struct { int i; });
29 switch (i)
31 int A[3];
32 default:
33 break;