diff options
| author | Richard Smith <richard-llvm@metafoo.co.uk> | 2012-10-10 01:10:59 +0000 |
|---|---|---|
| committer | Richard Smith <richard-llvm@metafoo.co.uk> | 2012-10-10 01:10:59 +0000 |
| commit | 22cc16462e4190717a5a67b38d3ffaa0983c2c26 (patch) | |
| tree | 56136ca87c75546971742a0ef648a4731b361ddb /compiler-rt/lib/ubsan/lit_tests | |
| parent | fe782158b2d506754026aef25fc69941aaa50f8b (diff) | |
| download | bcm5719-llvm-22cc16462e4190717a5a67b38d3ffaa0983c2c26.tar.gz bcm5719-llvm-22cc16462e4190717a5a67b38d3ffaa0983c2c26.zip | |
-fcatch-undefined-behavior: handler for VLA bound which evaluates to a non-positive value.
llvm-svn: 165582
Diffstat (limited to 'compiler-rt/lib/ubsan/lit_tests')
| -rw-r--r-- | compiler-rt/lib/ubsan/lit_tests/Misc/vla.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/compiler-rt/lib/ubsan/lit_tests/Misc/vla.c b/compiler-rt/lib/ubsan/lit_tests/Misc/vla.c new file mode 100644 index 00000000000..4137e804e8d --- /dev/null +++ b/compiler-rt/lib/ubsan/lit_tests/Misc/vla.c @@ -0,0 +1,11 @@ +// RUN: %clang -fcatch-undefined-behavior %s -O3 -o %t +// RUN: %t 2>&1 | FileCheck %s --check-prefix=CHECK-MINUS-ONE +// RUN: %t a 2>&1 | FileCheck %s --check-prefix=CHECK-ZERO +// RUN: %t a b + +int main(int argc, char **argv) { + // CHECK-MINUS-ONE: vla.c:9:11: fatal error: variable length array bound evaluates to non-positive value -1 + // CHECK-ZERO: vla.c:9:11: fatal error: variable length array bound evaluates to non-positive value 0 + int arr[argc - 2]; + return 0; +} |

