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 | |
15 | char glob1[1]; |
16 | char glob2[2]; |
17 | char glob3[3]; |
18 | char glob4[4]; |
19 | char glob5[5]; |
20 | char glob6[6]; |
21 | char glob7[7]; |
22 | char glob8[8]; |
23 | char glob9[9]; |
24 | char glob10[10]; |
25 | char glob11[11]; |
26 | char glob12[12]; |
27 | char glob13[13]; |
28 | char glob14[14]; |
29 | char glob15[15]; |
30 | char glob16[16]; |
31 | char glob17[17]; |
32 | char glob1000[1000]; |
33 | char glob10000[10000]; |
34 | char glob100000[100000]; |
35 | |
36 | static char static10[10]; |
37 | |
38 | int 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 | |