annotate compiler-rt/test/dfsan/basic.c @ 221:79ff65ed7e25

LLVM12 Original
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Tue, 15 Jun 2021 19:15:29 +0900
parents 1d019706d866
children 5f17cb93ff66
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
150
anatofuz
parents:
diff changeset
1 // RUN: %clang_dfsan %s -o %t && %run %t
anatofuz
parents:
diff changeset
2 // RUN: %clang_dfsan -mllvm -dfsan-args-abi %s -o %t && %run %t
221
79ff65ed7e25 LLVM12 Original
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
3 //
79ff65ed7e25 LLVM12 Original
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
4 // REQUIRES: x86_64-target-arch
150
anatofuz
parents:
diff changeset
5
anatofuz
parents:
diff changeset
6 // Tests that labels are propagated through loads and stores.
anatofuz
parents:
diff changeset
7
anatofuz
parents:
diff changeset
8 #include <sanitizer/dfsan_interface.h>
anatofuz
parents:
diff changeset
9 #include <assert.h>
anatofuz
parents:
diff changeset
10
anatofuz
parents:
diff changeset
11 int main(void) {
anatofuz
parents:
diff changeset
12 int i = 1;
anatofuz
parents:
diff changeset
13 dfsan_label i_label = dfsan_create_label("i", 0);
anatofuz
parents:
diff changeset
14 dfsan_set_label(i_label, &i, sizeof(i));
anatofuz
parents:
diff changeset
15
anatofuz
parents:
diff changeset
16 dfsan_label new_label = dfsan_get_label(i);
anatofuz
parents:
diff changeset
17 assert(i_label == new_label);
anatofuz
parents:
diff changeset
18
anatofuz
parents:
diff changeset
19 dfsan_label read_label = dfsan_read_label(&i, sizeof(i));
anatofuz
parents:
diff changeset
20 assert(i_label == read_label);
anatofuz
parents:
diff changeset
21
anatofuz
parents:
diff changeset
22 dfsan_label j_label = dfsan_create_label("j", 0);
anatofuz
parents:
diff changeset
23 dfsan_add_label(j_label, &i, sizeof(i));
anatofuz
parents:
diff changeset
24
anatofuz
parents:
diff changeset
25 read_label = dfsan_read_label(&i, sizeof(i));
anatofuz
parents:
diff changeset
26 assert(dfsan_has_label(read_label, i_label));
anatofuz
parents:
diff changeset
27 assert(dfsan_has_label(read_label, j_label));
anatofuz
parents:
diff changeset
28
anatofuz
parents:
diff changeset
29 return 0;
anatofuz
parents:
diff changeset
30 }