[FEA]: Add host-side sanitizers
- Dominant language
- C++
- Stars
- 2.5k
- Forks
- 486
- Avg merge
- 2d 6h
- Merged PRs (30d)
- 295
Description
### Is this a duplicate?
- [X] I confirmed there appear to be no [duplicate issues](https://github.com/NVIDIA/cccl/issues) for this request and that I agree to the [Code of Conduct](CODE_OF_CONDUCT.md)
### Area
Infrastructure
### Is your feature request related to a problem? Please describe.
Sanitizers are extremely useful for detecting hard-to-find and subtle bugs. They include `UB sanitizer`, `address sanitizer`, `memory sanitizer`, and `thread sanitizer`. They can work in conjunction with CUDA code with a few workarounds. They are complementary to CUDA `compute-sanitizer`. Compiler-provided sanitizers are also lightweight and much more efficient than external tools such as `valgrind`.
I don't see such support for the current build configurations. It would be great to add them to make the CCCL libraries even more robust.
Other optional tools are the static analyzers provided by the main compilers
- GCC `-fanalyzer` https://gcc.gnu.org/onlinedocs/gcc/Static-Analyzer-Options.html
- Clang `scan-build` https://clang.llvm.org/docs/analyzer/user-docs/CommandLineUsage.html#scan-build
- MSVC `/analyze` https://learn.microsoft.com/en-us/cpp/build/reference/analyze-code-analysis?view=msvc-170
_Risks_: very low detection rate and false positives
### Describe the solution you'd like
Add common compiler flags for GCC/Clang:
- https://clang.llvm.org/docs/AddressSanitizer.html
- https://clang.llvm.org/docs/ThreadSanitizer.html
- https://clang.llvm.org/docs/MemorySanitizer.html
- https://clang.llvm.org/docs/UndefinedBehaviorSanitizer.html
- https://clang.llvm.org/docs/LeakSanitizer.html
- https://gcc.gnu.org/onlinedocs/gcc/Instrumentation-Options.html#index-fsanitize_003daddress
- https://gcc.gnu.org/onlinedocs/gcc/Instrumentation-Options.html#index-fsanitize_003dundefined
### Describe alternatives you've considered
_No response_
### Additional context
_No response_
Contributor guide
Assessment
This issue has not been assessed yet.