<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 - clang integer sanitizer warns about int values returned by _mm_extract_epi16"
href="https://bugs.llvm.org/show_bug.cgi?id=41657">41657</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>clang integer sanitizer warns about int values returned by _mm_extract_epi16
</td>
</tr>
<tr>
<th>Product</th>
<td>new-bugs
</td>
</tr>
<tr>
<th>Version</th>
<td>7.0
</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>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>unassignedbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>johannkoenig@google.com
</td>
</tr>
<tr>
<th>CC</th>
<td>htmldeveloper@gmail.com, llvm-bugs@lists.llvm.org
</td>
</tr></table>
<p>
<div>
<pre>Created <span class=""><a href="attachment.cgi?id=21850" name="attach_21850" title="minimized repro">attachment 21850</a> <a href="attachment.cgi?id=21850&action=edit" title="minimized repro">[details]</a></span>
minimized repro
Really, _mm_extract_epi16() should return int16_t and not int:
<a href="https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_extract_epi16&expand=2420">https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_extract_epi16&expand=2420</a>
But because it returns int (even though the value it is extracting is 16 bits)
there are spurious warnings when the high bit is 1:
$ clang -fsanitize=integer test.c
$ ./a.out
test.c:6:13: runtime error: implicit conversion from type 'int' of value 65535
(32-bit, signed) to type 'short' changed the value to -1 (16-bit, signed)
#0 0x42b76c in main
(/usr/local/google/home/johannkoenig/build/a.out+0x42b76c)
#1 0x7ff03078a2b0 in __libc_start_main
(/lib/x86_64-linux-gnu/libc.so.6+0x202b0)</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>