1// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
2// See https://llvm.org/LICENSE.txt for license information.
3// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
4
5// When tracing data flow, explode the number of DFSan labels.
6#include <cstddef>
7#include <cstdint>
8
9static volatile int sink;
10
11__attribute__((noinline))
12void f(uint8_t a, uint8_t b, uint8_t c, uint8_t d) {
13 if (a == b + 1 && c == d + 2)
14 sink++;
15 if (a == d + 1 && c == b + 2)
16 sink++;
17}
18
19extern "C" int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) {
20 for (size_t a = 0; a < Size; a++)
21 for (size_t b = 0; b < Size; b++)
22 for (size_t c = 0; c < Size; c++)
23 for (size_t d = 0; d < Size; d++)
24 f(a: Data[a], b: Data[b], c: Data[c], d: Data[d]);
25 return 0;
26}
27

source code of compiler-rt/test/fuzzer/ExplodeDFSanLabelsTest.cpp