]> git.proxmox.com Git - rustc.git/blame - src/compiler-rt/test/msan/keep-going-dso.cc
Imported Upstream version 1.6.0+dfsg1
[rustc.git] / src / compiler-rt / test / msan / keep-going-dso.cc
CommitLineData
92a42be0 1// RUN: %clangxx_msan -O0 %s -o %t && not %run %t >%t.out 2>&1
1a4d82fc 2// FileCheck --check-prefix=CHECK-KEEP-GOING %s <%t.out
92a42be0 3// RUN: %clangxx_msan -O0 %s -o %t && MSAN_OPTIONS=keep_going=0 not %run %t >%t.out 2>&1
1a4d82fc 4// FileCheck %s <%t.out
92a42be0 5// RUN: %clangxx_msan -O0 %s -o %t && MSAN_OPTIONS=keep_going=1 not %run %t >%t.out 2>&1
1a4d82fc
JJ
6// FileCheck --check-prefix=CHECK-KEEP-GOING %s <%t.out
7
92a42be0 8// RUN: %clangxx_msan -mllvm -msan-keep-going=1 -O0 %s -o %t && not %run %t >%t.out 2>&1
1a4d82fc 9// FileCheck --check-prefix=CHECK-KEEP-GOING %s <%t.out
92a42be0 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
1a4d82fc 11// FileCheck %s <%t.out
92a42be0 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
1a4d82fc
JJ
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
24int 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}