1// RUN: %clang_dfsan %s -fsanitize-ignorelist=%S/Inputs/flags_abilist.txt -mllvm -dfsan-debug-nonzero-labels -o %t && %run %t 2>&1 | FileCheck %s
2// RUN: %clang_dfsan %s -fsanitize-ignorelist=%S/Inputs/flags_abilist.txt -mllvm -dfsan-debug-nonzero-labels -o %t && DFSAN_OPTIONS=warn_unimplemented=0 %run %t 2>&1 | count 0
3// RUN: %clang_dfsan %s -fsanitize-ignorelist=%S/Inputs/flags_abilist.txt -mllvm -dfsan-debug-nonzero-labels -o %t && DFSAN_OPTIONS=warn_nonzero_labels=1 %run %t 2>&1 | FileCheck --check-prefix=CHECK-NONZERO %s
4//
5// REQUIRES: x86_64-target-arch
6
7// Tests that flags work correctly.
8
9#include <sanitizer/dfsan_interface.h>
10
11int f(int i) {
12 return i;
13}
14
15int main(void) {
16 int i = 1;
17 dfsan_label i_label = dfsan_create_label("i", 0);
18 dfsan_set_label(i_label, &i, sizeof(i));
19
20 // CHECK: WARNING: DataFlowSanitizer: call to uninstrumented function f
21 // CHECK-NOT: WARNING: DataFlowSanitizer: saw nonzero label
22 // CHECK-NONZERO: WARNING: DataFlowSanitizer: saw nonzero label
23 f(i);
24
25 return 0;
26}
27