Please update the -fsanitize=address and -fsanitize=thread documentation to specify what additional flags are required. From my tests: -fsanitize=thread requires -fPIC for compilation and -pie or -shared for linking. -fsanitize=address doesn't require any special flags They both need -g for meaningful output (i.e. if you want to run asan_symbolize on it), and I've seen asan's wiki recommend -fno-omit-frame-pointer too. If you have an older binutils then -gdwarf-3 is required too, otherwise asan_symbolize (which invokes addr2line) can't resolve the symbol addresses to sourcefile:linenumber locations.
>-fsanitize=thread I think it requires -fPIE but really it should not.
This issue is 5+ years old and I think there have been a lot of improvements to the sanitizers meanwhile. Can the maintainers please comment on what additional options are currently required/recommended?
I really believe there's no need for any extra options on top of -sanitize={address,thread} right now. The only recommendation would be about the -g option in order to have nice backtraces and variable locations.
Is -g also recommended for the other -fsanitize= options?
Maybe for leak, not sure about that. For UBSan I think it isn't needed.