<html>
<head>
<base href="https://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 --- - LLVM/Clang 3.7.0 become undeterministic at >= -O1"
href="https://llvm.org/bugs/show_bug.cgi?id=24734">24734</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>LLVM/Clang 3.7.0 become undeterministic at >= -O1
</td>
</tr>
<tr>
<th>Product</th>
<td>clang
</td>
</tr>
<tr>
<th>Version</th>
<td>3.7
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>All
</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>-New Bugs
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>ed@80386.nl
</td>
</tr>
<tr>
<th>CC</th>
<td>llvm-bugs@lists.llvm.org
</td>
</tr>
<tr>
<th>Classification</th>
<td>Unclassified
</td>
</tr></table>
<p>
<div>
<pre>I have noticed that Clang 3.7.0-release generates non-reproducible results
across different operating systems. Below are steps how this can be reproduced.
1. Install a vanilla copy of Clang 3.7.0-release.
2. Add a symbolic link from '${prefix}/bin/x86_64-unknown-cloudabi-c++' to the
Clang 3.7.0-release binary. This allows us to invoke Clang as a cross compiler
for a fixed architecture+platform. It may also apply to others
architectures+platforms, but I haven't tested this.
3. Download the attached preprocessed source code, which is an unmodified copy
of Google RE2's parse.cc (2015-08-01 release).
4. Run the following commands on this source file:
x86_64-unknown-cloudabi-c++ -c -std=c++11 -c -o foo0.o foo.cc
x86_64-unknown-cloudabi-c++ -c -std=c++11 -c -o foo1.o foo.cc -O
If we now take a look at the checksums of these generated .o files, we see that
if we build this source file on FreeBSD (where Clang was built with Clang
3.4.1) and Mac OS X, we get:
MD5 (foo0.o) = 53e1cb694319999f5849707c373afe53
MD5 (foo1.o) = ae901cc696454a1bd8c438998fa348a4
On Linux (where Clang was built with GCC 4.9.1-16ubuntu6), however, we see:
MD5 (foo0.o) = 53e1cb694319999f5849707c373afe53
MD5 (foo1.o) = 7b2690e4aaab1a162c42b1e7c858e5c7
The difference in generated code is fairly small, though:
...
3a4: 49 8d 7a 01 lea 0x1(%r10),%rdi
3a8: 83 f9 0a cmp $0xa,%ecx
3ab: 72 cd jb 37a <...>
- 3ad: ff ce dec %esi
- 3af: 49 8d 7a ff lea -0x1(%r10),%rdi
+ 3ad: 49 8d 7a ff lea -0x1(%r10),%rdi
+ 3b1: ff ce dec %esi
3b3: 89 f0 mov %esi,%eax
3b5: 85 c0 test %eax,%eax
3b7: 0f 84 dd 06 00 00 je a9a <...>
...
I'm filing this bug, as it makes it harder to get consistent build results in
heterogeneous environments. It may also be an indicator for a low-level bug,
where</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>