1 //===-- asan_globals_test.cc ----------------------------------------------===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 //
10 // This file is a part of AddressSanitizer, an address sanity checker.
11 //
12 // Some globals in a separate file.
13 //===----------------------------------------------------------------------===//
14 #include "asan_test_utils.h"
15 
16 char glob1[1];
17 char glob2[2];
18 char glob3[3];
19 char glob4[4];
20 char glob5[5];
21 char glob6[6];
22 char glob7[7];
23 char glob8[8];
24 char glob9[9];
25 char glob10[10];
26 char glob11[11];
27 char glob12[12];
28 char glob13[13];
29 char glob14[14];
30 char glob15[15];
31 char glob16[16];
32 char glob17[17];
33 char glob1000[1000];
34 char glob10000[10000];
35 char glob100000[100000];
36 
37 static char static10[10];
38 
GlobalsTest(int zero)39 int GlobalsTest(int zero) {
40   static char func_static15[15];
41   glob5[zero] = 0;
42   static10[zero] = 0;
43   func_static15[zero] = 0;
44   return glob5[1] + func_static15[2];
45 }
46