diff options
author | dim <dim@FreeBSD.org> | 2011-02-20 13:06:31 +0000 |
---|---|---|
committer | dim <dim@FreeBSD.org> | 2011-02-20 13:06:31 +0000 |
commit | 39fcc9a984e2820e4ea0fa2ac4abd17d9f3a31df (patch) | |
tree | a9243275843fbeaa590afc07ee888e006b8d54ea /test/Sema/scope-check.c | |
parent | 69b4eca4a4255ba43baa5c1d9bbdec3ec17f479e (diff) | |
download | FreeBSD-src-39fcc9a984e2820e4ea0fa2ac4abd17d9f3a31df.zip FreeBSD-src-39fcc9a984e2820e4ea0fa2ac4abd17d9f3a31df.tar.gz |
Vendor import of clang trunk r126079:
http://llvm.org/svn/llvm-project/cfe/trunk@126079
Diffstat (limited to 'test/Sema/scope-check.c')
-rw-r--r-- | test/Sema/scope-check.c | 35 |
1 files changed, 34 insertions, 1 deletions
diff --git a/test/Sema/scope-check.c b/test/Sema/scope-check.c index 4ccb64c..a9494d3 100644 --- a/test/Sema/scope-check.c +++ b/test/Sema/scope-check.c @@ -133,7 +133,7 @@ int test8(int x) { void test9(int n, void *P) { int Y; int Z = 4; - goto *P; // expected-warning {{indirect goto might cross protected scopes}} + goto *P; // expected-error {{indirect goto might cross protected scopes}} L2: ; int a[n]; // expected-note {{jump bypasses initialization of variable length array}} @@ -199,3 +199,36 @@ void test13(int n, void *p) { a0: ; static void *ps[] = { &&a0 }; } + +int test14(int n) { + static void *ps[] = { &&a0, &&a1 }; + if (n < 0) + goto *&&a0; + + if (n > 0) { + int vla[n]; + a1: + vla[n-1] = 0; + } + a0: + return 0; +} + + +// PR8473: IR gen can't deal with indirect gotos past VLA +// initialization, so that really needs to be a hard error. +void test15(int n, void *pc) { + static const void *addrs[] = { &&L1, &&L2 }; + + goto *pc; // expected-error {{indirect goto might cross protected scope}} + + L1: + { + char vla[n]; // expected-note {{jump bypasses initialization}} + L2: // expected-note {{possible target}} + vla[0] = 'a'; + } +} + +// rdar://9024687 +int test16(int [sizeof &&z]); // expected-error {{use of address-of-label extension outside of a function body}} |