To differentiate between an AddressSanitizer (ASan) error and a program exit, set ASAN_OPTIONS=halt_on_error=0
to allow the program to continue running after an ASan error. Then check the logs or output for ASan-specific error messages rather than relying solely on the exit code. Unfortunately, exitcode
in ASAN_OPTIONS
doesn't work as expected in all cases due to tool limitations. A more robust approach is to wrap your program in a script that captures ASan output for analysis.