<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 - wrong code with "-O3 -mllvm -enable-newgvn" in both 32-bit and 64-bit mode on x86_64-linux-gnu"
href="https://bugs.llvm.org/show_bug.cgi?id=34093">34093</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>wrong code with "-O3 -mllvm -enable-newgvn" in both 32-bit and 64-bit mode on x86_64-linux-gnu
</td>
</tr>
<tr>
<th>Product</th>
<td>clang
</td>
</tr>
<tr>
<th>Version</th>
<td>unspecified
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>Windows NT
</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>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>chengniansun@gmail.com
</td>
</tr>
<tr>
<th>CC</th>
<td>llvm-bugs@lists.llvm.org
</td>
</tr></table>
<p>
<div>
<pre>$ clang-trunk -v
clang version 6.0.0 (trunk 310206)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /usr/bin
Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/4.8
Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/4.8.4
Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/4.9
Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/4.9.2
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.8
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.8.4
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.9
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.9.2
Selected GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/4.9
Candidate multilib: .;@m64
Candidate multilib: 32;@m32
Candidate multilib: x32;@mx32
Selected multilib: .;@m64
$ clang-trunk -mllvm -enable-newgvn -m32 -O3 -w small.c ; ./a.out
5
$ clang-trunk -m32 -O3 -w small.c ; ./a.out
0
$ cat small.c
int printf(const char *, ...);
int a, b, c, d = 5, e, f, g, h, i, j, k;
short l;
static unsigned fn1(p1) {
int m = 0;
a = k;
j = 7;
for (; j >= 0; j--) {
l = j * 7081;
if (l *((m ^= g | 1) == a)) {
e &= (short)m &(d = i ^= d && 5);
for (; f; f++)
for (; h; h++)
;
} else if (c)
return p1;
a |= p1;
}
}
int main() {
for (;;) {
fn1(b);
break;
}
printf("%d\n", d);
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>