Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / compiler-rt / test / dfsan / force_zero.c
bloba3966f8db0fcdd2fa1f392a132b2c72fa23a4817
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
4 #include <sanitizer/dfsan_interface.h>
6 #include <assert.h>
8 int function_to_force_zero(int i, int* out) {
9 *out = i;
10 return i;
13 int main(void) {
14 int i = 1;
15 dfsan_label i_label = 2;
16 dfsan_set_label(i_label, &i, sizeof(i));
18 int out = 0;
19 int ret = function_to_force_zero(i, &out);
21 #ifdef FORCE_ZERO_LABELS
22 assert(dfsan_get_label(out) == 0);
23 assert(dfsan_get_label(ret) == 0);
24 #else
25 assert(dfsan_get_label(out) == i_label);
26 assert(dfsan_get_label(ret) == i_label);
27 #endif
29 return 0;