• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // RUN: %clangxx_msan -O0 %s -o %t && not %run %t >%t.out 2>&1
2 // FileCheck --check-prefix=CHECK-KEEP-GOING %s <%t.out
3 // RUN: %clangxx_msan -O0 %s -o %t && MSAN_OPTIONS=keep_going=0 not %run %t >%t.out 2>&1
4 // FileCheck %s <%t.out
5 // RUN: %clangxx_msan -O0 %s -o %t && MSAN_OPTIONS=keep_going=1 not %run %t >%t.out 2>&1
6 // FileCheck --check-prefix=CHECK-KEEP-GOING %s <%t.out
7 
8 // RUN: %clangxx_msan -mllvm -msan-keep-going=1 -O0 %s -o %t && not %run %t >%t.out 2>&1
9 // FileCheck --check-prefix=CHECK-KEEP-GOING %s <%t.out
10 // RUN: %clangxx_msan -mllvm -msan-keep-going=1 -O0 %s -o %t && MSAN_OPTIONS=keep_going=0 not %run %t >%t.out 2>&1
11 // FileCheck %s <%t.out
12 // RUN: %clangxx_msan -mllvm -msan-keep-going=1 -O0 %s -o %t && MSAN_OPTIONS=keep_going=1 not %run %t >%t.out 2>&1
13 // FileCheck --check-prefix=CHECK-KEEP-GOING %s <%t.out
14 
15 // Test how -mllvm -msan-keep-going and MSAN_OPTIONS=keep_going affect reports
16 // from interceptors.
17 // -mllvm -msan-keep-going provides the default value of keep_going flag, but is
18 // always overwritten by MSAN_OPTIONS
19 
20 #include <stdio.h>
21 #include <stdlib.h>
22 #include <string.h>
23 
main(int argc,char ** argv)24 int main(int argc, char **argv) {
25   char *volatile x = (char*)malloc(5 * sizeof(char));
26   x[4] = 0;
27   if (strlen(x) < 3)
28     exit(0);
29   fprintf(stderr, "Done\n");
30   // CHECK-NOT: Done
31   // CHECK-KEEP-GOING: Done
32   return 0;
33 }
34