annotate gcc/testsuite/gcc.dg/c99-vla-jump-5.c @ 145:1830386684a0

gcc-9.2.0
author anatofuz
date Thu, 13 Feb 2020 11:34:05 +0900
parents 04ced10e8804
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
111
kono
parents:
diff changeset
1 /* Test for labels and VM declarations: bug 12913.
kono
parents:
diff changeset
2 switch statements must not jump into the scope of VM declarations.
kono
parents:
diff changeset
3
kono
parents:
diff changeset
4 c99-vla-jump-1.c tests with just that label and goto, VLAs.
kono
parents:
diff changeset
5 c99-vla-jump-2.c tests with many other labels and gotos, VLAs.
kono
parents:
diff changeset
6 c99-vla-jump-3.c tests with just that label and goto, VM.
kono
parents:
diff changeset
7 c99-vla-jump-4.c tests with many other labels and gotos, VM.
kono
parents:
diff changeset
8 c99-vla-jump-5.c tests with switch statements. */
kono
parents:
diff changeset
9
kono
parents:
diff changeset
10 /* Origin: Joseph Myers <joseph@codesourcery.com> */
kono
parents:
diff changeset
11 /* { dg-do compile } */
kono
parents:
diff changeset
12 /* { dg-options "-std=iso9899:1999 -pedantic-errors" } */
kono
parents:
diff changeset
13
kono
parents:
diff changeset
14 void
kono
parents:
diff changeset
15 f (int a, int b)
kono
parents:
diff changeset
16 {
kono
parents:
diff changeset
17 switch (a) { /* { dg-warning "statement will never be executed" } */
kono
parents:
diff changeset
18 int v[b];
kono
parents:
diff changeset
19 case 2: /* { dg-error "switch jumps into scope of identifier with variably modified type" } */
kono
parents:
diff changeset
20 default: /* { dg-error "switch jumps into scope of identifier with variably modified type" } */
kono
parents:
diff changeset
21 switch (a)
kono
parents:
diff changeset
22 {
kono
parents:
diff changeset
23 case 4:
kono
parents:
diff changeset
24 { int z[b]; }
kono
parents:
diff changeset
25 default:
kono
parents:
diff changeset
26 ;
kono
parents:
diff changeset
27 int w[b];
kono
parents:
diff changeset
28 }
kono
parents:
diff changeset
29 }
kono
parents:
diff changeset
30 }
kono
parents:
diff changeset
31
kono
parents:
diff changeset
32 /* Match extra informative notes. */
kono
parents:
diff changeset
33 /* { dg-message "note: switch starts here" "note: starts" { target *-*-* } 0 } */
kono
parents:
diff changeset
34 /* { dg-message "note: '\[^\n'\]*' declared here" "note: declared" { target *-*-* } 0 } */