diff options
author | Reid Kleckner <rnk@google.com> | 2016-07-21 21:04:34 +0000 |
---|---|---|
committer | Reid Kleckner <rnk@google.com> | 2016-07-21 21:04:34 +0000 |
commit | 1a53607f6f9d24816253759aee0881684b0c3807 (patch) | |
tree | e4bf361c1415e9625c91354e3ab61090e1b770aa /test/asan/TestCases/Windows | |
parent | 839a300bae34bdcc1b3e85a16da8c54341254492 (diff) |
[asan] Fix Win64 test portability issues
The OOM test should really only run on 32-bits, since it's hard to OOM
on x64.
The operator_array_new_with_dtor_left_oob tests need to account for the
larger array cookie on x64 (8 bytes instead of 4).
Use -std=c++14 in use-after-scope-capture.cc to avoid errors in the MSVC
2015 STL on Windows. The default there is C++14 anyway.
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@276332 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/asan/TestCases/Windows')
3 files changed, 5 insertions, 4 deletions
diff --git a/test/asan/TestCases/Windows/dll_operator_array_new_with_dtor_left_oob.cc b/test/asan/TestCases/Windows/dll_operator_array_new_with_dtor_left_oob.cc index 8306a737b..b514c994c 100644 --- a/test/asan/TestCases/Windows/dll_operator_array_new_with_dtor_left_oob.cc +++ b/test/asan/TestCases/Windows/dll_operator_array_new_with_dtor_left_oob.cc @@ -10,7 +10,7 @@ struct C { extern "C" __declspec(dllexport) int test_function() { C *buffer = new C[42]; - buffer[-2].x = 42; + buffer[-(1 + sizeof(void*) / 4)].x = 42; // CHECK: AddressSanitizer: heap-buffer-overflow on address [[ADDR:0x[0-9a-f]+]] // CHECK: WRITE of size 4 at [[ADDR]] thread T0 // CHECK-NEXT: test_function {{.*}}dll_operator_array_new_with_dtor_left_oob.cc:[[@LINE-3]] @@ -19,7 +19,7 @@ int test_function() { // FIXME: Currently it says "4 bytes ... left of 172-byte region", // should be "8 bytes ... left of 168-byte region", see // https://code.google.com/p/address-sanitizer/issues/detail?id=314 -// CHECK: [[ADDR]] is located {{.*}} bytes to the left of 172-byte region +// CHECK: [[ADDR]] is located {{.*}} bytes to the left of {{(172|176)}}-byte region // FIXME: Should get rid of the malloc/free frames called from the inside of // operator new/delete in DLLs when using -MT CRT. // FIXME: The operator new frame should have []. diff --git a/test/asan/TestCases/Windows/oom.cc b/test/asan/TestCases/Windows/oom.cc index 3475af79e..59cc7ed0e 100644 --- a/test/asan/TestCases/Windows/oom.cc +++ b/test/asan/TestCases/Windows/oom.cc @@ -1,5 +1,6 @@ // RUN: %clang_cl_asan -O0 %s -Fe%t // RUN: not %run %t 2>&1 | FileCheck %s +// REQUIRES: asan-32-bits #include <malloc.h> diff --git a/test/asan/TestCases/Windows/operator_array_new_with_dtor_left_oob.cc b/test/asan/TestCases/Windows/operator_array_new_with_dtor_left_oob.cc index 63f2929bd..aae9d5ec8 100644 --- a/test/asan/TestCases/Windows/operator_array_new_with_dtor_left_oob.cc +++ b/test/asan/TestCases/Windows/operator_array_new_with_dtor_left_oob.cc @@ -8,7 +8,7 @@ struct C { int main() { C *buffer = new C[42]; - buffer[-2].x = 42; + buffer[-(1 + sizeof(void*) / 4)].x = 42; // CHECK: AddressSanitizer: heap-buffer-overflow on address [[ADDR:0x[0-9a-f]+]] // CHECK: WRITE of size 4 at [[ADDR]] thread T0 // CHECK-NEXT: {{#0 .* main .*operator_array_new_with_dtor_left_oob.cc}}:[[@LINE-3]] @@ -16,7 +16,7 @@ int main() { // FIXME: Currently it says "4 bytes ... left of 172-byte region", // should be "8 bytes ... left of 168-byte region", see // https://code.google.com/p/address-sanitizer/issues/detail?id=314 -// CHECK: [[ADDR]] is located {{.*}} bytes to the left of 172-byte region +// CHECK: [[ADDR]] is located {{.*}} bytes to the left of {{(172|176)}}-byte region // CHECK-LABEL: allocated by thread T0 here: // FIXME: The 'operator new' frame should have []. // CHECK-NEXT: {{#0 .* operator new}} |