1 // RUN: %clangxx_asan -O0 %s -Fe%t 2>&1
2 // 'cat' is used below to work around FileCheck buffering bug which makes this
3 // test flaky. FIXME: file an issue.
4 // RUN: not %run %t 2>&1 | cat | FileCheck %s --check-prefix=CHECK
8 DWORD WINAPI
thread_proc(void *context
) {
10 volatile char stack_buffer
[42];
11 stack_buffer
[subscript
] = 42;
12 // CHECK: AddressSanitizer: stack-buffer-overflow on address [[ADDR:0x[0-9a-f]+]]
13 // CHECK: WRITE of size 1 at [[ADDR]] thread T1
14 // CHECK: {{#0 .* thread_proc .*thread_stack_array_left_oob.cc}}:[[@LINE-3]]
15 // CHECK: Address [[ADDR]] is located in stack of thread T1 at offset {{.*}} in frame
21 HANDLE thr
= CreateThread(NULL
, 0, thread_proc
, NULL
, 0, NULL
);
22 // CHECK: Thread T1 created by T0 here:
23 // CHECK: {{#[01] .* main .*thread_stack_array_left_oob.cc}}:[[@LINE-2]]
24 WaitForSingleObject(thr
, INFINITE
);