]>
git.proxmox.com Git - rustc.git/blob - src/libcompiler_builtins/compiler-rt/test/asan/TestCases/alloca_constant_size.cc
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
10 // MSVC provides _alloca instead of alloca.
11 #if defined(_MSC_VER) && !defined(alloca)
12 # define alloca _alloca
13 #elif defined(__FreeBSD__)
21 char *dynamic_buffer
= (char *)alloca(200);
22 fprintf(stderr
, "dynamic_buffer = %p\n", dynamic_buffer
);
23 memset(dynamic_buffer
, 'y', 200);
27 static const int kDynamicArraySize
= 200;
30 char dynamic_buffer
[kDynamicArraySize
];
31 fprintf(stderr
, "dynamic_buffer = %p\n", dynamic_buffer
);
32 memset(dynamic_buffer
, 'y', kDynamicArraySize
);
38 memset(buf
, 'x', 1024);
41 int main(int argc
, const char *argv
[]) {
42 if (!strcmp(argv
[1], "1")) {
44 } else if (!strcmp(argv
[1], "2")) {
48 fprintf(stderr
, "Done.\n");
52 // CHECK-NOT: ERROR: AddressSanitizer