Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Overview
AddressSanitizer (ASAN) runs as an LLVM pass, which instruments code to detect reading and writing to out of bounds memory addresses at runtime.
Related Issue
AddressSanitizer Overview
sanitize_address
LLVM attribute.Discussion
clang -fsanitize=address
, the ASAN pass will run twice and cause issues. However, it is useful to run the ASAN pass withclang
, since the-fsanitize=address
flag will also handle linking to the runtimeASAN
library.persist_to_obj
, so that if you would like to also compile binaries with ASAN using only Rusty, it's there with some notes. However, I haven't looked into how it needs to be integrated into the linker, such that the runtime libraries are found and linked properly. It may be that it's not a high priority to include this feature, given ASAN is a more advanced functionality to begin with, and it's easy enough to link withclang
.Example
You can test the address sanitizer with the following commands: