<html>
<head>
<base href="https://bugs.llvm.org/">
</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 - missing div-by-zero warning"
href="https://bugs.llvm.org/show_bug.cgi?id=32126">32126</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>missing div-by-zero warning
</td>
</tr>
<tr>
<th>Product</th>
<td>clang
</td>
</tr>
<tr>
<th>Version</th>
<td>3.9
</td>
</tr>
<tr>
<th>Hardware</th>
<td>All
</td>
</tr>
<tr>
<th>OS</th>
<td>Linux
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>enhancement
</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>arnd@linaro.org
</td>
</tr>
<tr>
<th>CC</th>
<td>llvm-bugs@lists.llvm.org
</td>
</tr></table>
<p>
<div>
<pre>I ran across a case where gcc turns a simple function
static inline int return0(void) { return 0; }
int provoke_div0_warning(void) { return 1 / return0(); }
into an unconditionally trapping instruction, but does not
warn about doing this, I opened PR79828 in gcc bugzilla
for this: <a href="https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79828">https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79828</a>
Cross-checking with clang revealed that the same input
instead of trapping leads to undefined behavior (returning
uninitialized register value) and also produces no warning,
even with -Weverything.
It would be nice to have a warning about this, and it could
also be useful to use a trapping instruction rather than
silent undefined behavior.</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>