Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.
Sign upMiscompilation while working on PR #50882 #52694
Comments
This comment has been minimized.
This comment has been minimized.
|
There are, interestingly, tons of differences between the mir between a build that works, and a build that doesn't. Both with rust master + the patch quoted above, the only difference being one was built with system llvm 5, and the other with the bundled llvm. I'm puzzled. |
This comment has been minimized.
This comment has been minimized.
|
Some more data:
So this could very well be a case of llvm versions being broken (or compiler integration of said versions). |
This comment has been minimized.
This comment has been minimized.
|
Ok, It's too late and I'm tired, all those last attempts were without the patch applied, so they don't count. I'll try again tomorrow. |
This comment has been minimized.
This comment has been minimized.
|
Not sure. Some ideas:
|
This comment has been minimized.
This comment has been minimized.
|
This reminds me that it would nice to be able to duplicate/"virtualize" lang items for testing purposes, so the old and new standard library (fragments) are completely separated. I should open an issue door that. |
This comment has been minimized.
This comment has been minimized.
|
So, restarting afresh:
So at least this is consistent with the initial results with ubuntu system llvm and bundled llvm. Time for a bisect. |
This comment has been minimized.
This comment has been minimized.
|
Bisection identified llvm-mirror/llvm@a57b9df as having fixed this. Which leads me to more questions:
|
This comment has been minimized.
This comment has been minimized.
|
The LLVM patch needs to be backported officially to new 5.* and 6.* patch versions if it fixes miscopilations IMO. |
This comment has been minimized.
This comment has been minimized.
|
I don't think a new dot release of 5 will happen, 6 is also unlikely. Having an upstream bug would help also. |
This comment has been minimized.
This comment has been minimized.
|
Some more notes:
|
This comment has been minimized.
This comment has been minimized.
|
Needless to say, #50882 is blocked until the latter is addressed in some way. |
This comment has been minimized.
This comment has been minimized.
|
travis provides llvm 6 too: https://github.com/travis-ci/apt-source-whitelist/pull/373/files |
This comment has been minimized.
This comment has been minimized.
|
It's not really a matter of what travis provides, it's a matter of what minimal version of system llvm rustc supports, and as of #51899, it's llvm 5. |
This comment has been minimized.
This comment has been minimized.
|
Interestingly, if the minimal supported version was still 3.9, this would have gone undetected. |
This comment has been minimized.
This comment has been minimized.
|
Guess why beta is not affected? Because rust-lang/llvm#106 applied llvm-mirror/llvm@a57b9df |
This comment has been minimized.
This comment has been minimized.
|
Backported on the llvm packages https://salsa.debian.org/pkg-llvm-team/llvm-toolchain/commit/1b9a00759063d68cb8b646df91807043643c33a7 |
moz-v2v-gh
pushed a commit
to mozilla/gecko-dev
that referenced
this issue
Jul 27, 2018
jankeromnes
pushed a commit
to jankeromnes/gecko
that referenced
this issue
Jul 27, 2018
nikic
added
the
A-LLVM
label
Dec 9, 2018
bors
added a commit
that referenced
this issue
Dec 16, 2018
bors
added a commit
that referenced
this issue
Dec 16, 2018
bors
added a commit
that referenced
this issue
Dec 16, 2018
bors
added a commit
that referenced
this issue
Dec 16, 2018
bors
added a commit
that referenced
this issue
Dec 17, 2018
This comment has been minimized.
This comment has been minimized.
|
It appears the miscompilation doesn't happen after #55426. |
glandium commentedJul 25, 2018
(Moving this to a separate issue because PR #50882 is already full of noise)
Reduced STR:
x.py test src/libstd --stage 1)What happens then is that
sync::once::tests::wait_for_force_to_finishfails with:The disassembly for
wait_for_force_to_finishonly contains one call tostd::thread::JoinHandle::join, instead of the expected two when the code is not miscompiled. That call is followed by a test that jumps to a panic when the result ofJoinHandle::joinis ...Ok(()):That
JoinHandle::joinreturns aResult<(), Box<Any>>, andOk(())is represented as(0, whatever). The destination of that jump is the panic code.At some point, I'm not entirely sure with what state of the tree, it was even better. The error was:
And there were two calls to
std::thread::JoinHandle::join, as expected, but they didn't have the same result handling:The destination of both jumps is panic code. The first jump, corresponding to
t1.join().is_ok()is correct, and the second, corresponding tot2.join().is_ok()is broken, thus the test failure.Even better: this doesn't happen when compiling with the bundled llvm. It also doesn't happen when extracting the test from libstd and compiling with a faulty compiler. It seems the fact that it's part of libstd, and that most of libstd is compiled along the test, plays a role.
I'm trying to get the corresponding mir and llvm-ir.