Index: lib/asan/asan_flags.inc =================================================================== --- lib/asan/asan_flags.inc +++ lib/asan/asan_flags.inc @@ -78,7 +78,7 @@ ASAN_FLAG(bool, unmap_shadow_on_exit, false, "If set, explicitly unmaps the (huge) shadow at exit.") ASAN_FLAG( - bool, abort_on_error, false, + bool, abort_on_error, (SANITIZER_MAC == 1), "If set, the tool calls abort() instead of _exit() after printing the " "error report.") ASAN_FLAG(bool, print_stats, false, Index: lib/asan/tests/asan_test_main.cc =================================================================== --- lib/asan/tests/asan_test_main.cc +++ lib/asan/tests/asan_test_main.cc @@ -15,7 +15,7 @@ // Default ASAN_OPTIONS for the unit tests. Let's turn symbolication off to // speed up testing (unit tests don't use it anyway). extern "C" const char* __asan_default_options() { - return "symbolize=false"; + return "symbolize=false:abort_on_error=0"; } int main(int argc, char **argv) { Index: test/asan/TestCases/Darwin/abort_on_error-darwin.cc =================================================================== --- test/asan/TestCases/Darwin/abort_on_error-darwin.cc +++ test/asan/TestCases/Darwin/abort_on_error-darwin.cc @@ -0,0 +1,16 @@ +// Check that with empty ASAN_OPTIONS, ASan reports on OS X actually crash +// the process (abort_on_error=1). See also Linux/abort_on_error-linux.cc. + +// RUN: %clangxx_asan %s -o %t + +// Intentionally don't inherit the default ASAN_OPTIONS. +// RUN: ASAN_OPTIONS="" not --crash %run %t 2>&1 | FileCheck %s + +#include +int main() { + char *x = (char*)malloc(10 * sizeof(char)); + free(x); + return x[5]; + // CHECK: {{.*ERROR: AddressSanitizer: heap-use-after-free on address}} + // CHECK: {{0x.* at pc 0x.* bp 0x.* sp 0x.*}} +} Index: test/asan/TestCases/Linux/abort_on_error-linux.cc =================================================================== --- test/asan/TestCases/Linux/abort_on_error-linux.cc +++ test/asan/TestCases/Linux/abort_on_error-linux.cc @@ -0,0 +1,16 @@ +// Check that with empty ASAN_OPTIONS, ASan reports on Linux don't crash +// the process (abort_on_error=0). See also Darwin/abort_on_error-darwin.cc. + +// RUN: %clangxx_asan %s -o %t + +// Intentionally don't inherit the default ASAN_OPTIONS. +// RUN: ASAN_OPTIONS="" not run %t 2>&1 | FileCheck %s + +#include +int main() { + char *x = (char*)malloc(10 * sizeof(char)); + free(x); + return x[5]; + // CHECK: {{.*ERROR: AddressSanitizer: heap-use-after-free on address}} + // CHECK: {{0x.* at pc 0x.* bp 0x.* sp 0x.*}} +} Index: test/asan/lit.cfg =================================================================== --- test/asan/lit.cfg +++ test/asan/lit.cfg @@ -30,7 +30,7 @@ config.name = 'AddressSanitizer' + config.name_suffix # Setup default ASAN_OPTIONS -config.environment['ASAN_OPTIONS'] = 'symbolize_vs_style=false' +config.environment['ASAN_OPTIONS'] = 'symbolize_vs_style=false:abort_on_error=0' # testFormat: The test format to use to interpret tests. external_bash = (not sys.platform in ['win32'])