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