<html>
<head>
<base href="http://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 --- - clang sanitizer regards IEC 60559 floating-point division by zero as undefined"
href="http://llvm.org/bugs/show_bug.cgi?id=17000">17000</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>clang sanitizer regards IEC 60559 floating-point division by zero as undefined
</td>
</tr>
<tr>
<th>Product</th>
<td>clang
</td>
</tr>
<tr>
<th>Version</th>
<td>trunk
</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>-New Bugs
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>vincent-llvm@vinc17.net
</td>
</tr>
<tr>
<th>CC</th>
<td>llvmbugs@cs.uiuc.edu
</td>
</tr>
<tr>
<th>Classification</th>
<td>Unclassified
</td>
</tr></table>
<p>
<div>
<pre>Annex F of the C standard (IEC 60559 / IEEE 754 support) defines the
floating-point division by zero, but clang (3.3 and 3.4 Debian snapshot)
regards it as undefined. This is incorrect: with
#include <stdio.h>
int main(void)
{
volatile double d;
#if __STDC_IEC_559__
d = 1.0 / 0.0;
printf ("%g\n", d);
#endif
return 0;
}
I get the following error:
ypig:~> clang tst.c -o tst -fsanitize=undefined -fno-sanitize-recover
ypig:~> ./tst
tst.c:7:11: runtime error: division by zero
zsh: exit 1 ./tst
When IEC 60559 is supported, "float-divide-by-zero" shouldn't be part of
"undefined". A user would would like to check division by zero could either
check the corresponding exception or explicitly add "float-divide-by-zero" to
-fsanitize.
My Debian bug report: <a href="http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=720935">http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=720935</a></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>