asan_globals_test.cc revision 1e172b4bdec57329bf904f063a29f99cddf2d85f
11e172b4bdec57329bf904f063a29f99cddf2d85fKostya Serebryany//===-- asan_globals_test.cc ------------*- C++ -*-===//
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//===----------------------------------------------------------------------===//
141e172b4bdec57329bf904f063a29f99cddf2d85fKostya Serebryany
151e172b4bdec57329bf904f063a29f99cddf2d85fKostya Serebryanyextern char glob5[5];
161e172b4bdec57329bf904f063a29f99cddf2d85fKostya Serebryanystatic char static10[10];
171e172b4bdec57329bf904f063a29f99cddf2d85fKostya Serebryany
181e172b4bdec57329bf904f063a29f99cddf2d85fKostya Serebryanyint GlobalsTest(int zero) {
191e172b4bdec57329bf904f063a29f99cddf2d85fKostya Serebryany  static char func_static15[15];
201e172b4bdec57329bf904f063a29f99cddf2d85fKostya Serebryany  glob5[zero] = 0;
211e172b4bdec57329bf904f063a29f99cddf2d85fKostya Serebryany  static10[zero] = 0;
221e172b4bdec57329bf904f063a29f99cddf2d85fKostya Serebryany  func_static15[zero] = 0;
231e172b4bdec57329bf904f063a29f99cddf2d85fKostya Serebryany  return glob5[1] + func_static15[2];
241e172b4bdec57329bf904f063a29f99cddf2d85fKostya Serebryany}
25