asan_globals_test.cc revision a3b0e5e4f9f48b2ed0baee10c0236eda7c21c660
1b0ddf227b25388ad836e560c00f0aec84026b0e5Alexey Samsonov//===-- asan_globals_test.cc ----------------------------------------------===//
21e172b4bdec57329bf904f063a29f99cddf2d85fKostya Serebryany//
31e172b4bdec57329bf904f063a29f99cddf2d85fKostya Serebryany//                     The LLVM Compiler Infrastructure
41e172b4bdec57329bf904f063a29f99cddf2d85fKostya Serebryany//
51e172b4bdec57329bf904f063a29f99cddf2d85fKostya Serebryany// This file is distributed under the University of Illinois Open Source
61e172b4bdec57329bf904f063a29f99cddf2d85fKostya Serebryany// License. See LICENSE.TXT for details.
71e172b4bdec57329bf904f063a29f99cddf2d85fKostya Serebryany//
81e172b4bdec57329bf904f063a29f99cddf2d85fKostya Serebryany//===----------------------------------------------------------------------===//
91e172b4bdec57329bf904f063a29f99cddf2d85fKostya Serebryany//
101e172b4bdec57329bf904f063a29f99cddf2d85fKostya Serebryany// This file is a part of AddressSanitizer, an address sanity checker.
111e172b4bdec57329bf904f063a29f99cddf2d85fKostya Serebryany//
121e172b4bdec57329bf904f063a29f99cddf2d85fKostya Serebryany// Some globals in a separate file.
131e172b4bdec57329bf904f063a29f99cddf2d85fKostya Serebryany//===----------------------------------------------------------------------===//
14a3b0e5e4f9f48b2ed0baee10c0236eda7c21c660Kostya Serebryany#include "asan_test_utils.h"
15a3b0e5e4f9f48b2ed0baee10c0236eda7c21c660Kostya Serebryany
16a3b0e5e4f9f48b2ed0baee10c0236eda7c21c660Kostya Serebryanychar glob1[1];
17a3b0e5e4f9f48b2ed0baee10c0236eda7c21c660Kostya Serebryanychar glob2[2];
18a3b0e5e4f9f48b2ed0baee10c0236eda7c21c660Kostya Serebryanychar glob3[3];
19a3b0e5e4f9f48b2ed0baee10c0236eda7c21c660Kostya Serebryanychar glob4[4];
20a3b0e5e4f9f48b2ed0baee10c0236eda7c21c660Kostya Serebryanychar glob5[5];
21a3b0e5e4f9f48b2ed0baee10c0236eda7c21c660Kostya Serebryanychar glob6[6];
22a3b0e5e4f9f48b2ed0baee10c0236eda7c21c660Kostya Serebryanychar glob7[7];
23a3b0e5e4f9f48b2ed0baee10c0236eda7c21c660Kostya Serebryanychar glob8[8];
24a3b0e5e4f9f48b2ed0baee10c0236eda7c21c660Kostya Serebryanychar glob9[9];
25a3b0e5e4f9f48b2ed0baee10c0236eda7c21c660Kostya Serebryanychar glob10[10];
26a3b0e5e4f9f48b2ed0baee10c0236eda7c21c660Kostya Serebryanychar glob11[11];
27a3b0e5e4f9f48b2ed0baee10c0236eda7c21c660Kostya Serebryanychar glob12[12];
28a3b0e5e4f9f48b2ed0baee10c0236eda7c21c660Kostya Serebryanychar glob13[13];
29a3b0e5e4f9f48b2ed0baee10c0236eda7c21c660Kostya Serebryanychar glob14[14];
30a3b0e5e4f9f48b2ed0baee10c0236eda7c21c660Kostya Serebryanychar glob15[15];
31a3b0e5e4f9f48b2ed0baee10c0236eda7c21c660Kostya Serebryanychar glob16[16];
32a3b0e5e4f9f48b2ed0baee10c0236eda7c21c660Kostya Serebryanychar glob17[17];
331e172b4bdec57329bf904f063a29f99cddf2d85fKostya Serebryany
341e172b4bdec57329bf904f063a29f99cddf2d85fKostya Serebryanystatic char static10[10];
351e172b4bdec57329bf904f063a29f99cddf2d85fKostya Serebryany
361e172b4bdec57329bf904f063a29f99cddf2d85fKostya Serebryanyint GlobalsTest(int zero) {
371e172b4bdec57329bf904f063a29f99cddf2d85fKostya Serebryany  static char func_static15[15];
381e172b4bdec57329bf904f063a29f99cddf2d85fKostya Serebryany  glob5[zero] = 0;
391e172b4bdec57329bf904f063a29f99cddf2d85fKostya Serebryany  static10[zero] = 0;
401e172b4bdec57329bf904f063a29f99cddf2d85fKostya Serebryany  func_static15[zero] = 0;
411e172b4bdec57329bf904f063a29f99cddf2d85fKostya Serebryany  return glob5[1] + func_static15[2];
421e172b4bdec57329bf904f063a29f99cddf2d85fKostya Serebryany}
43