-// 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
-// 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.
char *buffer = (char*)malloc(42);
free(buffer);
A<char*> 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<char *,{{ *}}1>{{.*}}demangled_names.cpp
-// CHECK: A<char *>::~A<char *>{{.*}}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<char *,{{ *}}1>{{.*}}demangled_names.cpp
+ // MINGW: baz<char*, true>{{.*}}demangled_names.cpp
+ // MSVC: A<char *>::~A<char *>{{.*}}demangled_names.cpp
+ // MINGW: A<char*>::~A(){{.*}}demangled_names.cpp
}
-// 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 <malloc.h>
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;
}
-// 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;
}
-// 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 <windows.h>
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;
}
-// 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 <windows.h>
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;
}
-// 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 {
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;
}
-// 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
// 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:{{.*}}