This reapplies 8fa66c6ca7 ([asan][windows]
Eliminate the static asan runtime on windows) for a second time.
That PR bounced off the tests because it caused failures in the other
sanitizer runtimes, these have been fixed by only building interception,
sanitizer_common, and asan with /MD, and continuing to build the rest of
the runtimes with /MT. This does mean that any usage of the static
ubsan/fuzzer/etc runtimes will mean you're mixing different runtime
library linkages in the same app, the interception, sanitizer_common,
and asan runtimes are designed for this, however it does result in some
linker warnings.
Additionally, it turns out when building in release-mode with
LLVM_ENABLE_PDBs the build system forced /OPT:ICF. This totally breaks
asan's "new" method of doing "weak" functions on windows, and so
/OPT:NOICF was explicitly added to asan's link flags.
---------
Co-authored-by: Amy Wishnousky <amyw@microsoft.com>
22 lines
722 B
C++
22 lines
722 B
C++
// RUN: %clang_cl_asan %Od %s %Fe%t
|
|
// RUN: not %run %t 2>&1 | FileCheck %s
|
|
|
|
#include <malloc.h>
|
|
|
|
int main() {
|
|
int *x = (int*)malloc(42 * sizeof(int));
|
|
free(x);
|
|
free(x);
|
|
// CHECK: AddressSanitizer: attempting double-free on [[ADDR:0x[0-9a-f]+]]
|
|
// CHECK-NEXT: {{#0 .* free }}
|
|
// CHECK: {{ #[1-3] .* main .*double_free.cpp}}:[[@LINE-3]]
|
|
// CHECK: [[ADDR]] is located 0 bytes inside of 168-byte region
|
|
// CHECK-LABEL: freed by thread T0 here:
|
|
// CHECK-NEXT: {{#0 .* free }}
|
|
// CHECK: {{ #[1-3] .* main .*double_free.cpp}}:[[@LINE-8]]
|
|
// CHECK-LABEL: previously allocated by thread T0 here:
|
|
// CHECK-NEXT: {{#0 .* malloc }}
|
|
// CHECK: {{ #[1-3] .* main .*double_free.cpp}}:[[@LINE-12]]
|
|
return 0;
|
|
}
|