[llvm-dev] Does -fsanitize=address cover -fsanitize=leak?

Fangrui Song via llvm-dev llvm-dev at lists.llvm.org
Tue Apr 20 16:30:53 PDT 2021


On 2021-04-20, Peng Yu via llvm-dev wrote:
>Hi,
>
>I see this page offers confusing information. The example uses
>-fsanitize=address, but the text below it says -fsanitize=leak.
>
>When I tried it, it seems that both -fsanitize=leak and
>-fsanitize=address are fine? So should -fsanitize=address be used
>instead -fsanitize=leak as the former covers more than the latter?
>Thanks.
>
>https://clang.llvm.org/docs/LeakSanitizer.html

The doc is outdated. I submitted https://reviews.llvm.org/D100907 to
update the supported platforms and clarify this sentence.

If the executable is linked with -fsanitize=address, indeed it gets
LeakSanitizer by default. See CAN_SANITIZE_LEAKS in
compiler-rt/lib/asan/asan_rtl.cpp
>
>-- 
>Regards,
>Peng
>_______________________________________________
>LLVM Developers mailing list
>llvm-dev at lists.llvm.org
>https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev


More information about the llvm-dev mailing list