diff options
author | Dimitry Andric <dim@FreeBSD.org> | 2010-09-17 15:54:40 +0000 |
---|---|---|
committer | Dimitry Andric <dim@FreeBSD.org> | 2010-09-17 15:54:40 +0000 |
commit | 3d1dcd9bfdb15c49ee34d576a065079ac5c4d29f (patch) | |
tree | 0bbe07708f7571f8b5291f6d7b96c102b7c99dee /test/Analysis/outofbound.c | |
parent | a0482fa4e7fa27b01184f938097f0666b78016dd (diff) |
Diffstat (limited to 'test/Analysis/outofbound.c')
-rw-r--r-- | test/Analysis/outofbound.c | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/test/Analysis/outofbound.c b/test/Analysis/outofbound.c index 9b487300c88ad..ed51dc6ac06ae 100644 --- a/test/Analysis/outofbound.c +++ b/test/Analysis/outofbound.c @@ -71,3 +71,27 @@ void sizeof_vla(int a) { y[5] = 5; // expected-warning{{out-of-bound}} } } + +void alloca_region(int a) { + if (a == 5) { + char *x = __builtin_alloca(a); + x[4] = 4; // no-warning + x[5] = 5; // expected-warning{{out-of-bound}} + } +} + +int symbolic_index(int a) { + int x[2] = {1, 2}; + if (a == 2) { + return x[a]; // expected-warning{{out-of-bound}} + } + return 0; +} + +int symbolic_index2(int a) { + int x[2] = {1, 2}; + if (a < 0) { + return x[a]; // expected-warning{{out-of-bound}} + } + return 0; +} |