<html>
<head>
<base href="https://llvm.org/bugs/" />
</head>
<body><table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Bug ID</th>
<td><a class="bz_bug_link
bz_status_NEW "
title="NEW --- - UBSan in recoverable mode should kill the program if at least one error was reported"
href="https://llvm.org/bugs/show_bug.cgi?id=25569">25569</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>UBSan in recoverable mode should kill the program if at least one error was reported
</td>
</tr>
<tr>
<th>Product</th>
<td>compiler-rt
</td>
</tr>
<tr>
<th>Version</th>
<td>unspecified
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>Linux
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>normal
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>compiler-rt
</td>
</tr>
<tr>
<th>Assignee</th>
<td>vonosmas@gmail.com
</td>
</tr>
<tr>
<th>Reporter</th>
<td>vonosmas@gmail.com
</td>
</tr>
<tr>
<th>CC</th>
<td>kcc@google.com, llvm-bugs@lists.llvm.org, richard-llvm@metafoo.co.uk
</td>
</tr>
<tr>
<th>Classification</th>
<td>Unclassified
</td>
</tr></table>
<p>
<div>
<pre>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.</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are on the CC list for the bug.</li>
</ul>
</body>
</html>