diff --git a/compiler-rt/test/asan/TestCases/Windows/crt_initializers.cpp b/compiler-rt/test/asan/TestCases/Windows/crt_initializers.cpp --- a/compiler-rt/test/asan/TestCases/Windows/crt_initializers.cpp +++ b/compiler-rt/test/asan/TestCases/Windows/crt_initializers.cpp @@ -1,6 +1,4 @@ -// UNSUPPORTED: target={{.*-windows-gnu}} - -// RUN: %clang_cl_asan -Od %s -Fe%t +// RUN: %clang_cl_asan %Od %s %Fe%t // RUN: %run %t | FileCheck %s // This is a test for http://code.google.com/p/address-sanitizer/issues/detail?id=305 diff --git a/compiler-rt/test/asan/TestCases/Windows/demangled_names.cpp b/compiler-rt/test/asan/TestCases/Windows/demangled_names.cpp --- a/compiler-rt/test/asan/TestCases/Windows/demangled_names.cpp +++ b/compiler-rt/test/asan/TestCases/Windows/demangled_names.cpp @@ -1,7 +1,5 @@ -// UNSUPPORTED: target={{.*-windows-gnu}} - -// RUN: %clang_cl_asan -Od %s -Fe%t -// RUN: not %run %t 2>&1 | FileCheck %s +// RUN: %clang_cl_asan %Od %s %Fe%t +// RUN: not %run %t 2>&1 | FileCheck %s --check-prefixes=CHECK,%if clang-cl %{MSVC%} %else %{MINGW%} // // This test makes sure ASan symbolizes stack traces the way they are typically // symbolized on Windows. @@ -44,9 +42,11 @@ char *buffer = (char*)malloc(42); free(buffer); A a(buffer); -// CHECK: AddressSanitizer: heap-use-after-free on address [[ADDR:0x[0-9a-f]+]] -// CHECK: foo::bar<42>{{.*}}demangled_names.cpp -// CHECK: foo::spam{{.*}}demangled_names.cpp -// CHECK: baz{{.*}}demangled_names.cpp -// CHECK: A::~A{{.*}}demangled_names.cpp + // CHECK: AddressSanitizer: heap-use-after-free on address [[ADDR:0x[0-9a-f]+]] + // CHECK: foo::bar<42>{{.*}}demangled_names.cpp + // CHECK: foo::spam{{.*}}demangled_names.cpp + // MSVC: baz{{.*}}demangled_names.cpp + // MINGW: baz{{.*}}demangled_names.cpp + // MSVC: A::~A{{.*}}demangled_names.cpp + // MINGW: A::~A(){{.*}}demangled_names.cpp } diff --git a/compiler-rt/test/asan/TestCases/Windows/double_operator_delete.cpp b/compiler-rt/test/asan/TestCases/Windows/double_operator_delete.cpp --- a/compiler-rt/test/asan/TestCases/Windows/double_operator_delete.cpp +++ b/compiler-rt/test/asan/TestCases/Windows/double_operator_delete.cpp @@ -1,6 +1,4 @@ -// UNSUPPORTED: target={{.*-windows-gnu}} - -// RUN: %clang_cl_asan -Od %s -Fe%t +// RUN: %clang_cl_asan %Od %s %Fe%t // RUN: not %run %t 2>&1 | FileCheck %s #include @@ -9,19 +7,16 @@ int *x = new int[42]; delete [] x; delete [] x; -// CHECK: AddressSanitizer: attempting double-free on [[ADDR:0x[0-9a-f]+]] -// FIXME: The 'operator delete' frame should have []. -// CHECK-NEXT: {{#0 .* operator delete}} -// CHECK-NEXT: {{#1 .* main .*double_operator_delete.cpp}}:[[@LINE-4]] -// CHECK: [[ADDR]] is located 0 bytes inside of 168-byte region -// CHECK-LABEL: freed by thread T0 here: -// FIXME: The 'operator delete' frame should have []. -// CHECK-NEXT: {{#0 .* operator delete}} -// CHECK-NEXT: {{#1 .* main .*double_operator_delete.cpp}}:[[@LINE-10]] -// CHECK-LABEL: previously allocated by thread T0 here: -// FIXME: The 'operator new' frame should have []. -// CHECK-NEXT: {{#0 .* operator new}} -// CHECK-NEXT: {{#1 .* main .*double_operator_delete.cpp}}:[[@LINE-15]] + // CHECK: AddressSanitizer: attempting double-free on [[ADDR:0x[0-9a-f]+]] + // CHECK-NEXT: {{#0 .* operator delete}}[] + // CHECK-NEXT: {{#1 .* main .*double_operator_delete.cpp}}:[[@LINE-3]] + // CHECK: [[ADDR]] is located 0 bytes inside of 168-byte region + // CHECK-LABEL: freed by thread T0 here: + // CHECK-NEXT: {{#0 .* operator delete}}[] + // CHECK-NEXT: {{#1 .* main .*double_operator_delete.cpp}}:[[@LINE-8]] + // CHECK-LABEL: previously allocated by thread T0 here: + // CHECK-NEXT: {{#0 .* operator new}}[] + // CHECK-NEXT: {{#1 .* main .*double_operator_delete.cpp}}:[[@LINE-12]] return 0; } diff --git a/compiler-rt/test/asan/TestCases/Windows/operator_array_new_left_oob.cpp b/compiler-rt/test/asan/TestCases/Windows/operator_array_new_left_oob.cpp --- a/compiler-rt/test/asan/TestCases/Windows/operator_array_new_left_oob.cpp +++ b/compiler-rt/test/asan/TestCases/Windows/operator_array_new_left_oob.cpp @@ -1,19 +1,16 @@ -// UNSUPPORTED: target={{.*-windows-gnu}} - -// RUN: %clang_cl_asan -Od %s -Fe%t +// RUN: %clang_cl_asan %Od %s %Fe%t // RUN: not %run %t 2>&1 | FileCheck %s int main() { char *buffer = new char[42]; buffer[-1] = 42; -// CHECK: AddressSanitizer: heap-buffer-overflow on address [[ADDR:0x[0-9a-f]+]] -// CHECK: WRITE of size 1 at [[ADDR]] thread T0 -// CHECK-NEXT: {{#0 .* main .*operator_array_new_left_oob.cpp}}:[[@LINE-3]] -// -// CHECK: [[ADDR]] is located 1 bytes before 42-byte region -// CHECK-LABEL: allocated by thread T0 here: -// FIXME: The 'operator new' frame should have []. -// CHECK-NEXT: {{#0 .* operator new}} -// CHECK-NEXT: {{#1 .* main .*operator_array_new_left_oob.cpp}}:[[@LINE-10]] + // CHECK: AddressSanitizer: heap-buffer-overflow on address [[ADDR:0x[0-9a-f]+]] + // CHECK: WRITE of size 1 at [[ADDR]] thread T0 + // CHECK-NEXT: {{#0 .* main .*operator_array_new_left_oob.cpp}}:[[@LINE-3]] + // + // CHECK: [[ADDR]] is located 1 bytes before 42-byte region + // CHECK-LABEL: allocated by thread T0 here: + // CHECK-NEXT: {{#0 .* operator new}}[] + // CHECK-NEXT: {{#1 .* main .*operator_array_new_left_oob.cpp}}:[[@LINE-9]] delete [] buffer; } diff --git a/compiler-rt/test/asan/TestCases/Windows/operator_array_new_right_oob.cpp b/compiler-rt/test/asan/TestCases/Windows/operator_array_new_right_oob.cpp --- a/compiler-rt/test/asan/TestCases/Windows/operator_array_new_right_oob.cpp +++ b/compiler-rt/test/asan/TestCases/Windows/operator_array_new_right_oob.cpp @@ -1,6 +1,4 @@ -// UNSUPPORTED: target={{.*-windows-gnu}} - -// RUN: %clang_cl_asan -Od %s -Fe%t +// RUN: %clang_cl_asan %Od %s %Fe%t // RUN: not %run %t 2>&1 | FileCheck %s #include @@ -8,13 +6,12 @@ int main() { char *buffer = new char[42]; buffer[42] = 42; -// CHECK: AddressSanitizer: heap-buffer-overflow on address [[ADDR:0x[0-9a-f]+]] -// CHECK: WRITE of size 1 at [[ADDR]] thread T0 -// CHECK: {{#0 .* main .*operator_array_new_right_oob.cpp}}:[[@LINE-3]] -// CHECK: [[ADDR]] is located 0 bytes after 42-byte region -// CHECK: allocated by thread T0 here: -// FIXME: The 'operator new' frame should have []. -// CHECK: {{#0 .* operator new}} -// CHECK: {{#1 .* main .*operator_array_new_right_oob.cpp}}:[[@LINE-9]] + // CHECK: AddressSanitizer: heap-buffer-overflow on address [[ADDR:0x[0-9a-f]+]] + // CHECK: WRITE of size 1 at [[ADDR]] thread T0 + // CHECK: {{#0 .* main .*operator_array_new_right_oob.cpp}}:[[@LINE-3]] + // CHECK: [[ADDR]] is located 0 bytes after 42-byte region + // CHECK: allocated by thread T0 here: + // CHECK: {{#0 .* operator new}}[] + // CHECK: {{#1 .* main .*operator_array_new_right_oob.cpp}}:[[@LINE-8]] delete [] buffer; } diff --git a/compiler-rt/test/asan/TestCases/Windows/operator_array_new_uaf.cpp b/compiler-rt/test/asan/TestCases/Windows/operator_array_new_uaf.cpp --- a/compiler-rt/test/asan/TestCases/Windows/operator_array_new_uaf.cpp +++ b/compiler-rt/test/asan/TestCases/Windows/operator_array_new_uaf.cpp @@ -1,6 +1,4 @@ -// UNSUPPORTED: target={{.*-windows-gnu}} - -// RUN: %clang_cl_asan -Od %s -Fe%t +// RUN: %clang_cl_asan %Od %s %Fe%t // RUN: not %run %t 2>&1 | FileCheck %s #include @@ -9,18 +7,16 @@ char *buffer = new char[42]; delete [] buffer; buffer[0] = 42; -// CHECK: AddressSanitizer: heap-use-after-free on address [[ADDR:0x[0-9a-f]+]] -// CHECK: WRITE of size 1 at [[ADDR]] thread T0 -// CHECK: {{#0 .* main .*operator_array_new_uaf.cpp}}:[[@LINE-3]] -// CHECK: [[ADDR]] is located 0 bytes inside of 42-byte region -// CHECK-LABEL: freed by thread T0 here: -// FIXME: The 'operator delete' frame should have []. -// CHECK: {{#0 .* operator delete}} -// CHECK: {{#1 .* main .*operator_array_new_uaf.cpp}}:[[@LINE-9]] -// CHECK-LABEL: previously allocated by thread T0 here: -// FIXME: The 'operator new' frame should have []. -// CHECK: {{#0 .* operator new}} -// CHECK: {{#1 .* main .*operator_array_new_uaf.cpp}}:[[@LINE-14]] + // CHECK: AddressSanitizer: heap-use-after-free on address [[ADDR:0x[0-9a-f]+]] + // CHECK: WRITE of size 1 at [[ADDR]] thread T0 + // CHECK: {{#0 .* main .*operator_array_new_uaf.cpp}}:[[@LINE-3]] + // CHECK: [[ADDR]] is located 0 bytes inside of 42-byte region + // CHECK-LABEL: freed by thread T0 here: + // CHECK: {{#0 .* operator delete}}[] + // CHECK: {{#1 .* main .*operator_array_new_uaf.cpp}}:[[@LINE-8]] + // CHECK-LABEL: previously allocated by thread T0 here: + // CHECK: {{#0 .* operator new}}[] + // CHECK: {{#1 .* main .*operator_array_new_uaf.cpp}}:[[@LINE-12]] return 0; } diff --git a/compiler-rt/test/asan/TestCases/Windows/operator_array_new_with_dtor_left_oob.cpp b/compiler-rt/test/asan/TestCases/Windows/operator_array_new_with_dtor_left_oob.cpp --- a/compiler-rt/test/asan/TestCases/Windows/operator_array_new_with_dtor_left_oob.cpp +++ b/compiler-rt/test/asan/TestCases/Windows/operator_array_new_with_dtor_left_oob.cpp @@ -1,6 +1,4 @@ -// UNSUPPORTED: target={{.*-windows-gnu}} - -// RUN: %clang_cl_asan -Od %s -Fe%t +// RUN: %clang_cl_asan %Od %s %Fe%t // RUN: not %run %t 2>&1 | FileCheck %s struct C { @@ -13,17 +11,16 @@ int main() { C *buffer = new C[42]; buffer[hide(-(1 + (int)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.cpp}}:[[@LINE-3]] -// -// 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 before {{(172|176)}}-byte region -// CHECK-LABEL: allocated by thread T0 here: -// FIXME: The 'operator new' frame should have []. -// CHECK-NEXT: {{#0 .* operator new}} -// CHECK-NEXT: {{#1 .* main .*operator_array_new_with_dtor_left_oob.cpp}}:[[@LINE-13]] + // 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.cpp}}:[[@LINE-3]] + // + // 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 before {{(172|176)}}-byte region + // CHECK-LABEL: allocated by thread T0 here: + // CHECK-NEXT: {{#0 .* operator new}}[] + // CHECK-NEXT: {{#1 .* main .*operator_array_new_with_dtor_left_oob.cpp}}:[[@LINE-12]] delete [] buffer; } diff --git a/compiler-rt/test/asan/TestCases/Windows/sse_misalignment.cpp b/compiler-rt/test/asan/TestCases/Windows/sse_misalignment.cpp --- a/compiler-rt/test/asan/TestCases/Windows/sse_misalignment.cpp +++ b/compiler-rt/test/asan/TestCases/Windows/sse_misalignment.cpp @@ -1,8 +1,9 @@ -// UNSUPPORTED: target={{.*-windows-gnu}} - -// RUN: %clang_cl_asan -Od %s -Fe%t +// RUN: %clang_cl_asan %Od %s %Fe%t // RUN: %env_asan_opts=handle_sigfpe=1 not %run %t 2>&1 | FileCheck %s +// FIXME: On MinGW frame #0 does not include the line number? +// XFAIL: target={{.*-windows-gnu}} + // Test the error output from misaligned SSE2 memory access. This is a READ // memory access. Windows appears to always provide an address of -1 for these // types of faults, and there doesn't seem to be a way to distinguish them from @@ -27,4 +28,4 @@ // CHECK: before alignment fault // CHECK: ERROR: AddressSanitizer: access-violation on unknown address {{0x[fF]*}} // CHECK-NEXT: The signal is caused by a READ memory access. -// CHECK-NEXT: #0 {{.*}} in test(void) {{.*}}misalignment.cpp:{{.*}} +// CHECK-NEXT: #0 {{.*}} in test({{(void)?}}) {{.*}}misalignment.cpp:{{.*}}