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