<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 --- - Wrong constant folding"
href="http://llvm.org/bugs/show_bug.cgi?id=17571">17571</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Wrong constant folding
</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>Linux
</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>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>LLVM + clang (trunk) for ARM miscompiles the following code with
optimization level -O1.
/*
$ clang -target arm-linux-gnueabi -I /usr/arm-linux-gnueabi/include
-mthumb -c error.c -o error.o -O1
$ arm-linux-gnueabi-gcc error.o -o error.out
$ qemu-arm -L /usr/arm-linux-gnueabi/ ./error.out
@NG@ t = 4294967296
$ clang -v
clang version 3.4 (<a href="http://llvm.org/git/clang.git">http://llvm.org/git/clang.git</a>
890a1baadf4bd4c0ef0e8cd9ba30ecdea48d75a6)
(<a href="http://llvm.org/git/llvm.git">http://llvm.org/git/llvm.git</a>
4fc2774b438c6c09f487362e53d5ac1a84edea73)
Target: x86_64-unknown-linux-gnu
Thread model: posix
*/
#include <stdio.h>
int main (void)
{
volatile int x = 1;
long long t = ( x & 2147483648LL ) << 1;
if (t != 0LL) { printf("@NG@ t = %lld\n", t); }
return 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>