15d71de26cedae3dafc17449fe0182045c0bd20e8Stephen Hines// FIXME: https://code.google.com/p/address-sanitizer/issues/detail?id=264
25d71de26cedae3dafc17449fe0182045c0bd20e8Stephen Hines// XFAIL: android
35d71de26cedae3dafc17449fe0182045c0bd20e8Stephen Hines//
42d1fdb26e458c4ddc04155c1d421bced3ba90cd0Stephen Hines// RUN: %clangxx_asan -O0 %s -o %t && not %run %t 2>&1 | FileCheck %s
5c9424276474a27bd7b6ae59e771371f850a08ba1Alexey Samsonov
6c9424276474a27bd7b6ae59e771371f850a08ba1Alexey Samsonovnamespace XXX {
7c9424276474a27bd7b6ae59e771371f850a08ba1Alexey Samsonovclass YYY {
8c9424276474a27bd7b6ae59e771371f850a08ba1Alexey Samsonov public:
9939316c822cc46e62684464eecd5cb2cefcf41c5Alexey Samsonov  static char ZZZ[];
10c9424276474a27bd7b6ae59e771371f850a08ba1Alexey Samsonov};
11939316c822cc46e62684464eecd5cb2cefcf41c5Alexey Samsonovchar YYY::ZZZ[] = "abc";
12c9424276474a27bd7b6ae59e771371f850a08ba1Alexey Samsonov}
13c9424276474a27bd7b6ae59e771371f850a08ba1Alexey Samsonov
14c9424276474a27bd7b6ae59e771371f850a08ba1Alexey Samsonovint main(int argc, char **argv) {
15939316c822cc46e62684464eecd5cb2cefcf41c5Alexey Samsonov  return (int)XXX::YYY::ZZZ[argc + 5];  // BOOM
16939316c822cc46e62684464eecd5cb2cefcf41c5Alexey Samsonov  // CHECK: {{READ of size 1 at 0x.*}}
17939316c822cc46e62684464eecd5cb2cefcf41c5Alexey Samsonov  // CHECK: {{0x.* is located 2 bytes to the right of global variable}}
18939316c822cc46e62684464eecd5cb2cefcf41c5Alexey Samsonov  // CHECK: 'XXX::YYY::ZZZ' {{.*}} of size 4
19939316c822cc46e62684464eecd5cb2cefcf41c5Alexey Samsonov  // CHECK: 'XXX::YYY::ZZZ' is ascii string 'abc'
20c9424276474a27bd7b6ae59e771371f850a08ba1Alexey Samsonov}
21