1// RUN: %clangxx_asan -O0 %s -o %t && not %run %t 2>&1 | FileCheck %s
2
3#include <string.h>
4
5namespace XXX {
6struct YYY {
7 static int ZZZ(int x) {
8 char array[10];
9 memset(s: array, c: 0, n: 10);
10 return array[x]; // BOOOM
11 // CHECK: ERROR: AddressSanitizer: stack-buffer-overflow
12 // CHECK: READ of size 1 at
13 // CHECK: is located in stack of thread T0 at offset
14 // CHECK: XXX::YYY::ZZZ
15 }
16};
17} // namespace XXX
18
19int main(int argc, char **argv) {
20 int res = XXX::YYY::ZZZ(x: argc + 10);
21 return res;
22}
23

source code of compiler-rt/test/asan/TestCases/stack-frame-demangle.cpp