1//===-- asan_globals_test.cpp ---------------------------------------------===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8//
9// This file is a part of AddressSanitizer, an address sanity checker.
10//
11// Some globals in a separate file.
12//===----------------------------------------------------------------------===//
13#include "asan_test_utils.h"
14
15char glob1[1];
16char glob2[2];
17char glob3[3];
18char glob4[4];
19char glob5[5];
20char glob6[6];
21char glob7[7];
22char glob8[8];
23char glob9[9];
24char glob10[10];
25char glob11[11];
26char glob12[12];
27char glob13[13];
28char glob14[14];
29char glob15[15];
30char glob16[16];
31char glob17[17];
32char glob1000[1000];
33char glob10000[10000];
34char glob100000[100000];
35
36static char static10[10];
37
38int GlobalsTest(int zero) {
39 static char func_static15[15];
40 glob5[zero] = 0;
41 static10[zero] = 0;
42 func_static15[zero] = 0;
43 return glob5[1] + func_static15[2];
44}
45

source code of compiler-rt/lib/asan/tests/asan_globals_test.cpp