diff options
author | Nico Weber <nicolasweber@gmx.de> | 2019-08-05 16:48:12 +0000 |
---|---|---|
committer | Nico Weber <nicolasweber@gmx.de> | 2019-08-05 16:48:12 +0000 |
commit | 673dc3d4a0b0fbb3b9b34ae2ecbfa522627fe582 (patch) | |
tree | 93e9f9c3508af096ba717ef85186950135b4c225 /compiler-rt/test/asan/TestCases/Windows/dll_allocators_sanity.cpp | |
parent | a96cfee98a22e262367868f343b599c2312149b7 (diff) | |
download | bcm5719-llvm-673dc3d4a0b0fbb3b9b34ae2ecbfa522627fe582.tar.gz bcm5719-llvm-673dc3d4a0b0fbb3b9b34ae2ecbfa522627fe582.zip |
compiler-rt: Rename cc files below test/asan to cpp
See r367803 and similar other changes.
llvm-svn: 367887
Diffstat (limited to 'compiler-rt/test/asan/TestCases/Windows/dll_allocators_sanity.cpp')
-rw-r--r-- | compiler-rt/test/asan/TestCases/Windows/dll_allocators_sanity.cpp | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/compiler-rt/test/asan/TestCases/Windows/dll_allocators_sanity.cpp b/compiler-rt/test/asan/TestCases/Windows/dll_allocators_sanity.cpp new file mode 100644 index 00000000000..9e0543cb66d --- /dev/null +++ b/compiler-rt/test/asan/TestCases/Windows/dll_allocators_sanity.cpp @@ -0,0 +1,39 @@ +// RUN: %clang_cl_asan -Od %p/dll_host.cpp -Fe%t +// RUN: %clang_cl_asan -LD -Od %s -Fe%t.dll +// RUN: %run %t %t.dll | FileCheck %s + +#include <malloc.h> +#include <stdio.h> + +extern "C" __declspec(dllexport) +int test_function() { + int *p = (int*)malloc(1024 * sizeof(int)); + p[512] = 0; + free(p); + + p = (int*)malloc(128); + p = (int*)realloc(p, 2048 * sizeof(int)); + p[1024] = 0; + free(p); + + p = (int*)calloc(16, sizeof(int)); + if (p[8] != 0) + return 1; + p[15]++; + if (16 * sizeof(int) != _msize(p)) + return 2; + free(p); + + p = new int; + *p = 42; + delete p; + + p = new int[42]; + p[15]++; + delete [] p; + + printf("All ok\n"); +// CHECK: All ok + + return 0; +} |