1 // RUN: %clang_dfsan %s -o %t
2 // RUN: %run %t
3 //
4 // REQUIRES: x86_64-target-arch
5 //
6 #include <sanitizer/dfsan_interface.h>
7
8 #include <assert.h>
9 #include <stdio.h>
10 #include <string.h>
11
foo(int a,int b)12 int foo(int a, int b) {
13 return a + b;
14 }
15
main(int argc,char * argv[])16 int main(int argc, char *argv[]) {
17 int a = 10;
18 int b = 20;
19 dfsan_set_label(8, &a, sizeof(a));
20 dfsan_set_label(128, &b, sizeof(b));
21 int c = foo(a, b);
22 printf("A: 0x%x\n", dfsan_get_label(a));
23 printf("B: 0x%x\n", dfsan_get_label(b));
24 dfsan_label l = dfsan_get_label(c);
25 printf("C: 0x%x\n", l);
26 assert(l == 136); // OR of the other two labels.
27 }
28