[llvm-bugs] [Bug 24734] New: LLVM/Clang 3.7.0 become undeterministic at >= -O1
via llvm-bugs
llvm-bugs at lists.llvm.org
Mon Sep 7 02:27:34 PDT 2015
https://llvm.org/bugs/show_bug.cgi?id=24734
Bug ID: 24734
Summary: LLVM/Clang 3.7.0 become undeterministic at >= -O1
Product: clang
Version: 3.7
Hardware: PC
OS: All
Status: NEW
Severity: normal
Priority: P
Component: -New Bugs
Assignee: unassignedclangbugs at nondot.org
Reporter: ed at 80386.nl
CC: llvm-bugs at lists.llvm.org
Classification: Unclassified
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
--
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20150907/635e0809/attachment.html>
More information about the llvm-bugs
mailing list