• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // RUN: %clang_dfsan %s -o %t && %run %t
2 // RUN: %clang_dfsan -mllvm -dfsan-args-abi %s -o %t && %run %t
3 
4 // Tests that labels are propagated through function calls.
5 
6 #include <sanitizer/dfsan_interface.h>
7 #include <assert.h>
8 
f(int x)9 int f(int x) {
10   int j = 2;
11   dfsan_label j_label = dfsan_create_label("j", 0);
12   dfsan_set_label(j_label, &j, sizeof(j));
13   return x + j;
14 }
15 
main(void)16 int main(void) {
17   int i = 1;
18   dfsan_label i_label = dfsan_create_label("i", 0);
19   dfsan_set_label(i_label, &i, sizeof(i));
20 
21   dfsan_label ij_label = dfsan_get_label(f(i));
22   assert(dfsan_has_label(ij_label, i_label));
23   assert(dfsan_has_label_with_desc(ij_label, "j"));
24 
25   return 0;
26 }
27