http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60275
Bug ID: 60275 Summary: [UBSAN] Add -f[no-]sanitize-recover/-fsanitize-undefined-trap-on-e rror to make UBSAN's runtime errors fatal Product: gcc Version: 4.9.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: sanitizer Assignee: unassigned at gcc dot gnu.org Reporter: burnus at gcc dot gnu.org CC: dodji at gcc dot gnu.org, dvyukov at gcc dot gnu.org, jakub at gcc dot gnu.org, kcc at gcc dot gnu.org, mpolacek at gcc dot gnu.org While I personally would like to see more fine tuning via UBSAN_FLAGS - similar to ASAN, LSAN and TSAN, adding CLANG's -fsanitize-recover/-fno-sanitize-recover and -fsanitize-undefined-trap-on-error would be useful as additional feature. >From CLANG: Extra features of UndefinedBehaviorSanitizer: - ``-fno-sanitize-recover``: By default, after a sanitizer diagnoses an issue, it will attempt to continue executing the program if there is a reasonable behavior it can give to the faulting operation. This option causes the program to abort instead. - ``-fsanitize-undefined-trap-on-error``: Causes traps to be emitted rather than calls to runtime libraries when a problem is detected. This option is intended for use in cases where the sanitizer runtime cannot be used (for instance, when building libc or a kernel module). This is only compatible with the sanitizers in the ``undefined-trap`` group. That would be BUILT_IN_UNREACHABLE and BUILT_IN_TRAP. (But unreachable shouldn't be dressed by SANITIZE_UNREACHABLE ;-) See also LLVM's * tools/clang/docs/UsersManual.rst * tools/clang/lib/CodeGen/CGExpr.cpp (search for SanitizeUndefinedTrapOnError and SanitizeRecover)