-
Notifications
You must be signed in to change notification settings - Fork 12.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Miscompilation while working on PR #50882 #52694
Comments
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. |
Some more data:
So this could very well be a case of llvm versions being broken (or compiler integration of said versions). |
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. |
Not sure. Some ideas:
|
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. |
So, restarting afresh:
So at least this is consistent with the initial results with ubuntu system llvm and bundled llvm. Time for a bisect. |
Bisection identified llvm-mirror/llvm@a57b9df as having fixed this. Which leads me to more questions:
|
The LLVM patch needs to be backported officially to new 5.* and 6.* patch versions if it fixes miscopilations IMO. |
I don't think a new dot release of 5 will happen, 6 is also unlikely. Having an upstream bug would help also. |
Some more notes:
|
Needless to say, #50882 is blocked until the latter is addressed in some way. |
travis provides llvm 6 too: https://github.com/travis-ci/apt-source-whitelist/pull/373/files |
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. |
Interestingly, if the minimal supported version was still 3.9, this would have gone undetected. |
Guess why beta is not affected? Because rust-lang/llvm#106 applied llvm-mirror/llvm@a57b9df |
Backported on the llvm packages https://salsa.debian.org/pkg-llvm-team/llvm-toolchain/commit/1b9a00759063d68cb8b646df91807043643c33a7 |
…patches. r=dmajor rust-lang/rust#52694 is a miscompilation I found in rust when it uses system llvm 5 or 6, that was fixed 5 months ago in the llvm rust bundles. This may or may not affect clang, but considering it was also reported to upstream llvm independently of rust, it's better to side with caution. It doesn't affect 3.9, and bug 1478919 got rid of the last use of clang 5 (except for clang-tidy, but that's not used to compile). The patches come from the llvm trunk from 5 months ago, so they're already in our clang 7 snapshots. Windows static analysis builds are still using an old trunk, but are stuck on bug 1427808. They're "only" for static analysis, though. --HG-- extra : rebase_source : f4fce69eb7c69b6245518a1bad37e04236c7075b
…patches. r=dmajor rust-lang/rust#52694 is a miscompilation I found in rust when it uses system llvm 5 or 6, that was fixed 5 months ago in the llvm rust bundles. This may or may not affect clang, but considering it was also reported to upstream llvm independently of rust, it's better to side with caution. It doesn't affect 3.9, and bug 1478919 got rid of the last use of clang 5 (except for clang-tidy, but that's not used to compile). The patches come from the llvm trunk from 5 months ago, so they're already in our clang 7 snapshots. Windows static analysis builds are still using an old trunk, but are stuck on bug 1427808. They're "only" for static analysis, though.
Bump minimum required LLVM version to 6.0 Based on the discussion in #55842, while the overall position of Rust wrt LLVM continues to be contentious, there does seem to be a consensus that there is no need for continued support of LLVM 5. This PR bumps our version requirement to LLVM 6.0 and makes Travis run against that. I hope that this is going to unblock #52694. If I understand correctly, while this issue still exists in LLVM 6, Ubuntu has backported the relevant patch. r? @alexcrichton
Bump minimum required LLVM version to 6.0 Based on the discussion in #55842, while the overall position of Rust wrt LLVM continues to be contentious, there does seem to be a consensus that there is no need for continued support of LLVM 5. This PR bumps our version requirement to LLVM 6.0 and makes Travis run against that. I hope that this is going to unblock #52694. If I understand correctly, while this issue still exists in LLVM 6, Ubuntu has backported the relevant patch. r? @alexcrichton
It appears the miscompilation doesn't happen after #55426. |
…patches. r=dmajor rust-lang/rust#52694 is a miscompilation I found in rust when it uses system llvm 5 or 6, that was fixed 5 months ago in the llvm rust bundles. This may or may not affect clang, but considering it was also reported to upstream llvm independently of rust, it's better to side with caution. It doesn't affect 3.9, and bug 1478919 got rid of the last use of clang 5 (except for clang-tidy, but that's not used to compile). The patches come from the llvm trunk from 5 months ago, so they're already in our clang 7 snapshots. Windows static analysis builds are still using an old trunk, but are stuck on bug 1427808. They're "only" for static analysis, though. UltraBlame original commit: dfe8ab123e01667be489a20b253e3cd3b20c10bd
…patches. r=dmajor rust-lang/rust#52694 is a miscompilation I found in rust when it uses system llvm 5 or 6, that was fixed 5 months ago in the llvm rust bundles. This may or may not affect clang, but considering it was also reported to upstream llvm independently of rust, it's better to side with caution. It doesn't affect 3.9, and bug 1478919 got rid of the last use of clang 5 (except for clang-tidy, but that's not used to compile). The patches come from the llvm trunk from 5 months ago, so they're already in our clang 7 snapshots. Windows static analysis builds are still using an old trunk, but are stuck on bug 1427808. They're "only" for static analysis, though. UltraBlame original commit: dfe8ab123e01667be489a20b253e3cd3b20c10bd
…patches. r=dmajor rust-lang/rust#52694 is a miscompilation I found in rust when it uses system llvm 5 or 6, that was fixed 5 months ago in the llvm rust bundles. This may or may not affect clang, but considering it was also reported to upstream llvm independently of rust, it's better to side with caution. It doesn't affect 3.9, and bug 1478919 got rid of the last use of clang 5 (except for clang-tidy, but that's not used to compile). The patches come from the llvm trunk from 5 months ago, so they're already in our clang 7 snapshots. Windows static analysis builds are still using an old trunk, but are stuck on bug 1427808. They're "only" for static analysis, though. UltraBlame original commit: dfe8ab123e01667be489a20b253e3cd3b20c10bd
(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_finish
fails with:The disassembly for
wait_for_force_to_finish
only 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::join
is ...Ok(())
:That
JoinHandle::join
returns 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.
The text was updated successfully, but these errors were encountered: