Skip to content
This repository was archived by the owner on Jan 12, 2024. It is now read-only.

Commit aaa16f4

Browse files
committed
Added more sanitizers to NS.
1 parent c029960 commit aaa16f4

File tree

4 files changed

+29
-7
lines changed

4 files changed

+29
-7
lines changed

src/Qir/Runtime/test-qir-runtime.ps1

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@
66
# TODO: `ASAN_OPTIONS=check_initialization_order=1` (https://clang.llvm.org/docs/AddressSanitizer.html#initialization-order-checking).
77
# TODO: macOS: `ASAN_OPTIONS=detect_leaks=1` (https://clang.llvm.org/docs/AddressSanitizer.html#memory-leak-detection).
88

9+
$env:ASAN_OPTIONS = "check_initialization_order=true:detect_stack_use_after_return=true:print_stats=true:" `
10+
+ "alloc_dealloc_mismatch=true:new_delete_type_mismatch=true:strict_init_order=true:strict_string_checks=true:" `
11+
+ "detect_invalid_pointer_pairs=2:detect_invalid_pointer_pairs=2"
12+
913
if (-not (Test-CTest (Join-Path $PSScriptRoot bin $Env:BUILD_CONFIGURATION unittests) "QIR Runtime")) {
1014
throw "At least one project failed testing. Check the logs."
1115
}

src/Qir/Samples/test-qir-samples.ps1

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@
55

66
# TODO: `ASAN_OPTIONS=check_initialization_order=1` (https://clang.llvm.org/docs/AddressSanitizer.html#initialization-order-checking).
77
# TODO: macOS: `ASAN_OPTIONS=detect_leaks=1` (https://clang.llvm.org/docs/AddressSanitizer.html#memory-leak-detection).
8+
$env:ASAN_OPTIONS = "check_initialization_order=true:detect_stack_use_after_return=true:print_stats=true:" `
9+
+ "alloc_dealloc_mismatch=true:new_delete_type_mismatch=true:strict_init_order=true:strict_string_checks=true:" `
10+
+ "detect_invalid_pointer_pairs=2:detect_invalid_pointer_pairs=2"
811

912
if (-not (Test-CTest (Join-Path $PSScriptRoot bin $Env:BUILD_CONFIGURATION StandaloneInputReference) "QIR Samples (StandaloneInputReference)")) {
1013
throw "At least one project failed testing. Check the logs."

src/Qir/Tests/test-qir-tests.ps1

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,17 @@ if ($Env:BUILD_CONFIGURATION -eq "Debug")
1616
if (-not ($IsWindows))
1717
{
1818
$env:LSAN_OPTIONS += "suppressions=../../../../LSan.ignore" # https://clang.llvm.org/docs/AddressSanitizer.html#suppressing-memory-leaks
19-
if (-not ($IsMacOS))
20-
{
21-
$env:ASAN_OPTIONS += "check_initialization_order=1" # https://clang.llvm.org/docs/AddressSanitizer.html#initialization-order-checking
22-
}
19+
#if (-not ($IsMacOS))
20+
#{
21+
# $env:ASAN_OPTIONS += "check_initialization_order=1" # https://clang.llvm.org/docs/AddressSanitizer.html#initialization-order-checking
22+
#}
2323
#else # AddressSanitizer: detect_leaks is not supported on this platform. Re-enable this once supported.
2424
#{
2525
# $env:ASAN_OPTIONS += "detect_leaks=1" # https://clang.llvm.org/docs/AddressSanitizer.html#memory-leak-detection
2626
#}
27+
$env:ASAN_OPTIONS = "check_initialization_order=true:detect_stack_use_after_return=true:print_stats=true:" `
28+
+ "alloc_dealloc_mismatch=true:new_delete_type_mismatch=true:strict_init_order=true:strict_string_checks=true:" `
29+
+ "detect_invalid_pointer_pairs=2:detect_invalid_pointer_pairs=2"
2730
}
2831
}
2932

src/Simulation/Native/build-native-simulator.ps1

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,23 @@ if (-not (Test-Path $nativeBuild)) {
1010
}
1111
Push-Location $nativeBuild
1212

13-
$SANITIZE_FLAGS="-fsanitize=undefined " `
13+
$SANITIZE_FLAGS=`
14+
"-fsanitize=undefined " `
15+
+ "-fsanitize=shift -fsanitize=shift-base " `
16+
+ "-fsanitize=integer-divide-by-zero -fsanitize=float-divide-by-zero " `
17+
+ "-fsanitize=unreachable " `
18+
+ "-fsanitize=vla-bound -fsanitize=null -fsanitize=return " `
19+
+ "-fsanitize=signed-integer-overflow -fsanitize=bounds -fsanitize=bounds-strict -fsanitize=alignment -fsanitize=object-size " `
20+
+ "-fsanitize=float-cast-overflow -fsanitize=nonnull-attribute -fsanitize=returns-nonnull-attribute -fsanitize=bool -fsanitize=enum " `
21+
+ "-fsanitize=vptr -fsanitize=pointer-overflow -fsanitize=builtin " `
22+
+ "-fsanitize=implicit-conversion -fsanitize=local-bounds -fsanitize=nullability " `
23+
`
1424
+ "-fsanitize=address " `
25+
+ "-fsanitize=pointer-compare -fsanitize=pointer-subtract " `
26+
+ "-fsanitize-address-use-after-scope " `
1527
+ "-fno-omit-frame-pointer -fno-optimize-sibling-calls"
16-
#+ "-fsanitize=float-divide-by-zero "
17-
#+ "-fsanitize=unsigned-integer-overflow -fsanitize=implicit-conversion -fsanitize=local-bounds -fsanitize=nullability "
28+
29+
#+ "-fsanitize=unsigned-integer-overflow "
1830

1931
# There should be no space after -D CMAKE_BUILD_TYPE= but if we provide the environment variable inline, without
2032
# the space it doesn't seem to get substituted... With invalid -D CMAKE_BUILD_TYPE argument cmake silently produces

0 commit comments

Comments
 (0)