1 // Regression test for https://github.com/google/sanitizers/issues/691
3 // RUN: %clangxx_asan -O0 %s -o %t -fstack-protector
4 // RUN: %run %t 1 2>&1 | FileCheck %s
5 // RUN: %run %t 2 2>&1 | FileCheck %s
11 // MSVC provides _alloca instead of alloca.
12 #if defined(_MSC_VER) && !defined(alloca)
13 # define alloca _alloca
16 #if defined(__sun__) && defined(__svr4__)
22 char *dynamic_buffer
= (char *)alloca(200);
23 fprintf(stderr
, "dynamic_buffer = %p\n", dynamic_buffer
);
24 memset(dynamic_buffer
, 'y', 200);
28 static const int kDynamicArraySize
= 200;
31 char dynamic_buffer
[kDynamicArraySize
];
32 fprintf(stderr
, "dynamic_buffer = %p\n", dynamic_buffer
);
33 memset(dynamic_buffer
, 'y', kDynamicArraySize
);
39 memset(buf
, 'x', 1024);
42 int main(int argc
, const char *argv
[]) {
43 if (!strcmp(argv
[1], "1")) {
45 } else if (!strcmp(argv
[1], "2")) {
49 fprintf(stderr
, "Done.\n");
53 // CHECK-NOT: ERROR: AddressSanitizer