<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 - __builtin_mul_overflow not lowered correctly"
href="https://bugs.llvm.org/show_bug.cgi?id=34920">34920</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>__builtin_mul_overflow not lowered correctly
</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>All
</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>LLVM Codegen
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>vsk@apple.com
</td>
</tr>
<tr>
<th>CC</th>
<td>llvm-bugs@lists.llvm.org
</td>
</tr></table>
<p>
<div>
<pre>Created <span class=""><a href="attachment.cgi?id=19264" name="attach_19264" title="Miscompilation example">attachment 19264</a> <a href="attachment.cgi?id=19264&action=edit" title="Miscompilation example">[details]</a></span>
Miscompilation example
We're miscompiling calls to __builtin_mul_overflow(), specifically when both
arguments have the same width but differ in signed-ness:
<a href="https://godbolt.org/g/cfmEEf">https://godbolt.org/g/cfmEEf</a> (I've also attached the example file).
W're emitting calls to overflow intrinsics which return i33, i65, and i129.
These are lowered into runtime calls which aren't correct: for example,
___mulodi4 doesn't correctly report overflow for 33-bit arguments.
Should we require that arguments to the overflow intrinsics have the same
signed-ness if they have the same width? Or should we provide backend and
runtime support for these exotic overflow checks?</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>