<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 --- - Uninitialized register on Shift operation"
href="http://llvm.org/bugs/show_bug.cgi?id=15607">15607</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Uninitialized register on Shift operation
</td>
</tr>
<tr>
<th>Product</th>
<td>libraries
</td>
</tr>
<tr>
<th>Version</th>
<td>3.1
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>MacOS X
</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>Backend: X86
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>ishiura-compiler@ml.kwansei.ac.jp
</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>Apple clang 4.1 (based on LLVM 3.1svn) seems to miscompile the
following C program with optimize option -O1.
$ cat test.c
int x = 0;
int main (void)
{
return ( 1 >> ( x << 8 ) ); /* should return 1 */
}
$ clang -O1 test.c
$ ./a.out
$ echo $?
0
Note that a.out may yield correct output (1) depending on
environments. This seems to happen because register "%cl" on the
"shrl" instruction is not initialized in the generated code.
pushq %rbp
Ltmp2:
.cfi_def_cfa_offset 16
Ltmp3:
.cfi_offset %rbp, -16
movq %rsp, %rbp
Ltmp4:
.cfi_def_cfa_register %rbp
movl $1, %eax
shrl %cl, %eax
popq %rbp
ret
The code may be valid for x != 0 (due to undefined behavior), but not
for x == 0.</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>