diff options
| author | John McCall <rjmccall@apple.com> | 2010-08-02 23:33:14 +0000 |
|---|---|---|
| committer | John McCall <rjmccall@apple.com> | 2010-08-02 23:33:14 +0000 |
| commit | 4a33fa95c014174b03bd56b357d05861e6379a37 (patch) | |
| tree | ca2da287b12c419b0df6001ca119f5d49dc63f6f /clang/test/Sema/scope-check.c | |
| parent | 460a356bf6c795618f6c7f82abdb9ec54bff6817 (diff) | |
| download | bcm5719-llvm-4a33fa95c014174b03bd56b357d05861e6379a37.tar.gz bcm5719-llvm-4a33fa95c014174b03bd56b357d05861e6379a37.zip | |
Labels (and case statement) don't create independent scope parents for the
purposes of the jump checker. Also extend Ted's iteration fix to labels.
Fixes PR7789.
llvm-svn: 110082
Diffstat (limited to 'clang/test/Sema/scope-check.c')
| -rw-r--r-- | clang/test/Sema/scope-check.c | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/clang/test/Sema/scope-check.c b/clang/test/Sema/scope-check.c index f3881ed086a..4ccb64c9aa0 100644 --- a/clang/test/Sema/scope-check.c +++ b/clang/test/Sema/scope-check.c @@ -1,7 +1,7 @@ // RUN: %clang_cc1 -fsyntax-only -verify -fblocks -std=gnu99 %s -Wno-unreachable-code int test1(int x) { - goto L; // expected-error{{illegal goto into protected scope}} + goto L; // expected-error{{goto into protected scope}} int a[x]; // expected-note {{jump bypasses initialization of variable length array}} int b[x]; // expected-note {{jump bypasses initialization of variable length array}} L: @@ -9,7 +9,7 @@ int test1(int x) { } int test2(int x) { - goto L; // expected-error{{illegal goto into protected scope}} + goto L; // expected-error{{goto into protected scope}} typedef int a[x]; // expected-note {{jump bypasses initialization of VLA typedef}} L: return sizeof(a); @@ -18,14 +18,14 @@ int test2(int x) { void test3clean(int*); int test3() { - goto L; // expected-error{{illegal goto into protected scope}} + goto L; // expected-error{{goto into protected scope}} int a __attribute((cleanup(test3clean))); // expected-note {{jump bypasses initialization of variable with __attribute__((cleanup))}} L: return a; } int test4(int x) { - goto L; // expected-error{{illegal goto into protected scope}} + goto L; // expected-error{{goto into protected scope}} int a[x]; // expected-note {{jump bypasses initialization of variable length array}} test4(x); L: @@ -50,7 +50,7 @@ void test7(int x) { switch (x) { case 1: ; int a[x]; // expected-note {{jump bypasses initialization of variable length array}} - case 2: // expected-error {{illegal switch case into protected scope}} + case 2: // expected-error {{switch case is in protected scope}} a[1] = 2; break; } @@ -58,17 +58,17 @@ void test7(int x) { int test8(int x) { // For statement. - goto L2; // expected-error {{illegal goto into protected scope}} + goto L2; // expected-error {{goto into protected scope}} for (int arr[x]; // expected-note {{jump bypasses initialization of variable length array}} ; ++x) L2:; // Statement expressions. - goto L3; // expected-error {{illegal goto into protected scope}} + goto L3; // expected-error {{goto into protected scope}} int Y = ({ int a[x]; // expected-note {{jump bypasses initialization of variable length array}} L3: 4; }); - goto L4; // expected-error {{illegal goto into protected scope}} + goto L4; // expected-error {{goto into protected scope}} { int A[x], // expected-note {{jump bypasses initialization of variable length array}} B[x]; // expected-note {{jump bypasses initialization of variable length array}} @@ -91,7 +91,7 @@ int test8(int x) { int A[x], B = ({ if (x) goto L7; else - goto L8; // expected-error {{illegal goto into protected scope}} + goto L8; // expected-error {{goto into protected scope}} 4; }), C[x]; // expected-note {{jump bypasses initialization of variable length array}} L8:; // bad @@ -103,7 +103,7 @@ int test8(int x) { goto L9; else // FIXME: - goto L10; // fixme-error {{illegal goto into protected scope}} + goto L10; // fixme-error {{goto into protected scope}} 4; })]; L10:; // bad } @@ -123,7 +123,7 @@ int test8(int x) { } // Statement expressions 2. - goto L1; // expected-error {{illegal goto into protected scope}} + goto L1; // expected-error {{goto into protected scope}} return x == ({ int a[x]; // expected-note {{jump bypasses initialization of variable length array}} L1: @@ -151,14 +151,14 @@ L4: } void test10(int n, void *P) { - goto L0; // expected-error {{illegal goto into protected scope}} + goto L0; // expected-error {{goto into protected scope}} typedef int A[n]; // expected-note {{jump bypasses initialization of VLA typedef}} L0: - goto L1; // expected-error {{illegal goto into protected scope}} + goto L1; // expected-error {{goto into protected scope}} A b, c[10]; // expected-note 2 {{jump bypasses initialization of variable length array}} L1: - goto L2; // expected-error {{illegal goto into protected scope}} + goto L2; // expected-error {{goto into protected scope}} A d[n]; // expected-note {{jump bypasses initialization of variable length array}} L2: return; @@ -171,7 +171,7 @@ void test11(int n) { case 2: case 3:; int Arr[n]; // expected-note {{jump bypasses initialization of variable length array}} - case 4: // expected-error {{illegal switch case into protected scope}} + case 4: // expected-error {{switch case is in protected scope}} return; } }; @@ -185,7 +185,7 @@ void test12(int n) { L1: goto L2; L2: - goto L3; // expected-error {{illegal goto into protected scope}} + goto L3; // expected-error {{goto into protected scope}} int Arr[n]; // expected-note {{jump bypasses initialization of variable length array}} L3: goto L4; |

