scope-check.c revision fd0c0cf85738a664e32f24f56972b3aca2419338
1// RUN: clang-cc -fsyntax-only -verify %s
2
3int test1(int x) {
4  goto L; // expected-error{{illegal jump}}
5  int a[x];
6  L:
7  return sizeof a;
8}
9
10int test2(int x) {
11  goto L; // expected-error{{illegal jump}}
12  typedef int a[x];
13  L:
14  return sizeof(a);
15}
16
17void test3clean(int*);
18
19int test3() {
20  goto L; // expected-error{{illegal jump}}
21int a __attribute((cleanup(test3clean)));
22L:
23  return a;
24}
25
26int test4(int x) {
27  goto L; // expected-error{{illegal jump}}
28int a[x];
29  test4(x);
30L:
31  return sizeof a;
32}
33
34int test5(int x) {
35  int a[x];
36  test5(x);
37  goto L;  // Ok.
38L:
39  goto L;  // Ok.
40  return sizeof a;
41}
42
43
44// FIXME: Switch cases etc.
45