[docs] Fix build-docs.sh
[llvm-project.git] / compiler-rt / test / dfsan / force_zero.c
blob6e1e87a6e67219b6201f13a00378b55e5e96c76a
1 // RUN: %clang_dfsan %s -fsanitize-ignorelist=%S/Inputs/flags_abilist.txt -DFORCE_ZERO_LABELS -o %t && %run %t
2 // RUN: %clang_dfsan %s -o %t && %run %t
3 //
4 // REQUIRES: x86_64-target-arch
6 #include <sanitizer/dfsan_interface.h>
8 #include <assert.h>
10 int function_to_force_zero(int i, int* out) {
11 *out = i;
12 return i;
15 int main(void) {
16 int i = 1;
17 dfsan_label i_label = 2;
18 dfsan_set_label(i_label, &i, sizeof(i));
20 int out = 0;
21 int ret = function_to_force_zero(i, &out);
23 #ifdef FORCE_ZERO_LABELS
24 assert(dfsan_get_label(out) == 0);
25 assert(dfsan_get_label(ret) == 0);
26 #else
27 assert(dfsan_get_label(out) == i_label);
28 assert(dfsan_get_label(ret) == i_label);
29 #endif
31 return 0;