• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // RUN: %clang -fsanitize=vla-bound %s -O3 -o %t
2 // RUN: %run %t 2>&1 | FileCheck %s --check-prefix=CHECK-MINUS-ONE
3 // RUN: %run %t a 2>&1 | FileCheck %s --check-prefix=CHECK-ZERO
4 // RUN: %run %t a b
5 
main(int argc,char ** argv)6 int main(int argc, char **argv) {
7   // CHECK-MINUS-ONE: vla.c:9:11: runtime error: variable length array bound evaluates to non-positive value -1
8   // CHECK-ZERO: vla.c:9:11: runtime error: variable length array bound evaluates to non-positive value 0
9   int arr[argc - 2];
10   return 0;
11 }
12