<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=15940">15940</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Wrong constant folding
</td>
</tr>
<tr>
<th>Product</th>
<td>libraries
</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>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>LLVM (git) + clang (3.4) for x86_64 miscompiles the following code.
$ cat error.c
int x = 1;
int main (void)
{
if ( 5 % ( 3 * x ) + 2 != 4 ) __builtin_abort();
return 0;
}
$ clang error.c -O1
$ ./a.out
Aborted (core dumped)
The following code with variable x replaced by "1" is
correctly compiled.
$ cat noerror.c
int main (void)
{
if ( 5 % ( 3 * 1 ) + 2 != 4 ) __builtin_abort();
return 0;
}
$ clang noerror.c -O1
$ ./a.out
0
$ clang -v
clang version 3.4 (<a href="http://llvm.org/git/clang.git">http://llvm.org/git/clang.git</a>
3923d6a87fe7b2c91cc4a7dbd90c4ec7e2316bcd)
(<a href="http://llvm.org/git/llvm.git">http://llvm.org/git/llvm.git</a>
363160a6be82df343fa60aa09d9d8f8f44605529)
Target: x86_64-unknown-linux-gnu
Thread model: posix</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>