1// RUN: %clang_cl_asan %Od %s %Fe%t
2// RUN: not %run %t 2>&1 | FileCheck %s
3
4#include <stdio.h>
5
6int main() {
7 int subscript = 42;
8 char buffer[42];
9 buffer[subscript] = 42;
10// CHECK: AddressSanitizer: stack-buffer-overflow on address [[ADDR:0x[0-9a-f]+]]
11// CHECK: WRITE of size 1 at [[ADDR]] thread T0
12// CHECK-NEXT: {{#0 .* main .*stack_array_right_oob.cpp}}:[[@LINE-3]]
13// CHECK: Address [[ADDR]] is located in stack of thread T0 at offset [[OFFSET:.*]] in frame
14// CHECK-NEXT: {{#0 .* main .*stack_array_right_oob.cpp}}
15// CHECK: 'buffer'{{.*}} <== Memory access at offset [[OFFSET]] overflows this variable
16}
17

source code of compiler-rt/test/asan/TestCases/Windows/stack_array_right_oob.cpp