[llvm-bugs] [Bug 25569] New: UBSan in recoverable mode should kill the program if at least one error was reported
via llvm-bugs
llvm-bugs at lists.llvm.org
Wed Nov 18 17:11:09 PST 2015
https://llvm.org/bugs/show_bug.cgi?id=25569
Bug ID: 25569
Summary: UBSan in recoverable mode should kill the program if
at least one error was reported
Product: compiler-rt
Version: unspecified
Hardware: PC
OS: Linux
Status: NEW
Severity: normal
Priority: P
Component: compiler-rt
Assignee: vonosmas at gmail.com
Reporter: vonosmas at gmail.com
CC: kcc at google.com, llvm-bugs at lists.llvm.org,
richard-llvm at metafoo.co.uk
Classification: Unclassified
If the program was compiled with -fsanitize=undefined, we may want
to kill the program with non-zero exit code if at least one problem was
detected and reported at runtime.
True, it's possible to use -fno-sanitize-recover=undefined, or
UBSAN_OPTIONS=halt_on_error=1 to make the failures fatal, but the user may want
to use recoverable mode to see (and keep track of) all the issues currently
reported.
See:
$ cat tmp/a.cc
#include <stdio.h>
#include <stdint.h>
int main() {
double d = 128.35;
int8_t i = static_cast<int8_t>(d);
printf("%d\n", i);
return 0;
}
$ ./bin/clang++ tmp/a.cc -fsanitize=float-cast-overflow && ./a.out && echo $?
tmp/a.cc:6:34: runtime error: value 128.35 is outside the range of
representable values of type 'signed char'
-128
0
FWIW, the behavior suggested here is what TSan does by default.
--
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20151119/26db30cf/attachment-0001.html>
More information about the llvm-bugs
mailing list