<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 detects signed integer overflow for multiplication of uint16_t"
href="https://llvm.org/bugs/show_bug.cgi?id=25580">25580</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>UBSan detects signed integer overflow for multiplication of uint16_t
</td>
</tr>
<tr>
<th>Product</th>
<td>new-bugs
</td>
</tr>
<tr>
<th>Version</th>
<td>trunk
</td>
</tr>
<tr>
<th>Hardware</th>
<td>All
</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>new bugs
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>slingn@gmail.com
</td>
</tr>
<tr>
<th>CC</th>
<td>llvm-bugs@lists.llvm.org
</td>
</tr>
<tr>
<th>Classification</th>
<td>Unclassified
</td>
</tr></table>
<p>
<div>
<pre>Created <span class=""><a href="attachment.cgi?id=15317" name="attach_15317" title="simple test case demonstrating the failure">attachment 15317</a> <a href="attachment.cgi?id=15317&action=edit" title="simple test case demonstrating the failure">[details]</a></span>
simple test case demonstrating the failure
First seen as a failing test for the SaturatingMultiply() function template
added in r253497.
Test case attached.
$ clang++ -O1 -std=c++11 -fsanitize=undefined test.cpp -o test
$ ./test
main.cpp:25:11: runtime error: signed integer overflow: 65535 * 65535 cannot be
represented in type 'int'
Interestingly, the failure only occurs with uint16_t.
The other unsigned types (uint8_t/uint32_t/uint64_t) pass if I comment out the
uint16_t case.
The issue reproduces at least with clang 3.6 on Ubuntu 15.10 x86_64 as well as
trunk Mac OS X 10.11.1 / Xcode 7.1.</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>