-
Notifications
You must be signed in to change notification settings - Fork 386
Rustup #329
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
Rustup #329
Conversation
Makes me wonder what changed to make this fail now. |
Let's see if it's in tomorrow's nightly. If not, it's related to the build system. I might have screwed up something, not sure. |
I cannot reproduce on today's nightly. That's weird. Rustc master must be doing something different from nightly + xargo |
So if you remove those "disable validation" flags again, do things still work on the CI? |
Probably. But we need them for the rustc integration. I need to test miri locally in release mode. Maybe that's it. It's the only difference I can see between this and rustc master |
That's not really sustainable, is it? When I go about revisiting these disabled tests, if they work locally (which so far has always agreed with CI...), I will enable them again. I will try to reproduce this. |
I just tried this with latest rustc master (and the patch to make miri compile again):
This works just fine. EDIT: Same for pointers.rs and unsized-tuple-impls.rs. So, I don't think these new flags should be merged. |
I'll check what's going on. Possible differences:
Either of these should not make any functional difference in the runtime of miri. I'll investigate tomorrow |
I built miri in debug mode, so that's not it. Anyway, until then I will make a PR with just our last commit so that we can get master green again. :) |
That's what I meant. rustc builds it in release mode. Anyway, I'm investigating now. |
Ah. Well, but so does our CI. |
Maybe rustc optimizes and thus inlines its MIR? Edit: fun fact: validation statements increase the inlining cost |
Nevermind, I just forgot the |
Can you get hold of the executed MIR? Are there any differences there? |
The first difference after erasing all hashes and allocids is < TRACE:rustc_miri::interpret::step: _ = _
---
> TRACE:rustc_miri::interpret::step: _ = &_ Where the latter is what happens on rustc master and the first is the nightly version. I have no clue where in the code that is, since the diff is quite verbose. But we can at least narrow it down to the fact that we are interpreting different MIR. |
Here's all the mir: https://send.firefox.com/download/b2c91e78e1/#sV7oV2sdglrpmvRyi9T_XQ (one time link) |
So the MIR of the program itself doesn't differ. It must be in the libstd. If I generate libstd via xargo on a stage1 compiler, everything works just like on nightly. Both times miri was built with the stage1 compiler. It also only happens if I build the stage1 compiler with the Any ideas how our libstd build differs from the stage1 libstd build? |
Can you find out which libstd function this first difference you mentioned above is in? |
lang_start https://github.com/rust-lang/rust/blob/master/src/libstd/rt.rs#L57 (just before the catch_unwind call) |
So the MIR of lang_start is different? That should be short enough to have a readable diff, or is it completely different? Then I could also check if I see the same effect. I am slightly surprised you are getting anywhere with stage 1 compilers; they never worked well for me with miri. Does anything change if you use stage 2? |
Minimal repro: fn one_line_ref() -> i16 {
*&1
}
fn main() {
one_line_ref();
} Without the The mir of lang_start in the crashing run is The regular mir is The diff is < StorageLive(_22); // scope 4 at /home/ws/ca8159/Projects/rust/rust/src/libstd/rt.rs:59:13: 59:16
< StorageLive(_23); // scope 4 at /home/ws/ca8159/Projects/rust/rust/src/libstd/rt.rs:59:39: 61:10
< StorageLive(_24); // scope 4 at /home/ws/ca8159/Projects/rust/rust/src/libstd/rt.rs:59:39: 61:10
< _24 = &_4; // scope 4 at /home/ws/ca8159/Projects/rust/rust/src/libstd/rt.rs:59:39: 61:10
< _23 = [closure]; // scope 4 at /home/ws/ca8159/Projects/rust/rust/src/libstd/rt.rs:59:39: 61:10
< StorageDead(_24); // scope 4 at /home/ws/ca8159/Projects/rust/rust/src/libstd/rt.rs:61:10: 61:10
< _22 = const std::panic::catch_unwind(_23) -> [return: bb9, unwind: bb10]; // scope 4 at /home/ws/ca8159/Projects/rust/rust/src/libstd/rt.rs:59:19: 61:11
---
> StorageLive(_22); // scope 4 at /home/ws/ca8159/Projects/rust/rust/src/libstd/rt.rs:63:13: 63:16
> StorageLive(_23); // scope 4 at /home/ws/ca8159/Projects/rust/rust/src/libstd/rt.rs:63:39: 63:70
> StorageLive(_24); // scope 4 at /home/ws/ca8159/Projects/rust/rust/src/libstd/rt.rs:63:65: 63:69
> _24 = _4; // scope 4 at /home/ws/ca8159/Projects/rust/rust/src/libstd/rt.rs:63:65: 63:69
> _23 = const std::intrinsics::transmute(_24) -> bb9; // scope 4 at /home/ws/ca8159/Projects/rust/rust/src/libstd/rt.rs:63:39: 63:70
93,97c91,94
< Validate(Acquire, [_22: std::result::Result<(), std::boxed::Box<std::any::Any + std::marker::Send + 'static>>]); // scope 4 at /home/ws/ca8159/Projects/rust/rust/src/libstd/rt.rs:59:19: 61:11
< Validate(Release, [_22: std::result::Result<(), std::boxed::Box<std::any::Any + std::marker::Send + 'static>>]); // scope 4 at /home/ws/ca8159/Projects/rust/rust/src/libstd/rt.rs:59:19: 61:11
< StorageDead(_23); // scope 4 at /home/ws/ca8159/Projects/rust/rust/src/libstd/rt.rs:61:11: 61:11
< EndRegion(); // scope 4 at /home/ws/ca8159/Projects/rust/rust/src/libstd/rt.rs:59:19: 61:11
< _25 = const std::sys_common::cleanup() -> [return: bb11, unwind: bb12]; // scope 5 at /home/ws/ca8159/Projects/rust/rust/src/libstd/rt.rs:64:9: 64:30
---
> Validate(Acquire, [_23: fn()]); // scope 4 at /home/ws/ca8159/Projects/rust/rust/src/libstd/rt.rs:63:39: 63:70
> Validate(Release, [_23: fn()]); // scope 4 at /home/ws/ca8159/Projects/rust/rust/src/libstd/rt.rs:63:39: 63:70
> StorageDead(_24); // scope 4 at /home/ws/ca8159/Projects/rust/rust/src/libstd/rt.rs:63:70: 63:70
> _22 = const std::panic::catch_unwind(_23) -> bb10; // scope 4 at /home/ws/ca8159/Projects/rust/rust/src/libstd/rt.rs:63:19: 63:71
101,102c98,101
< EndRegion(); // scope 4 at /home/ws/ca8159/Projects/rust/rust/src/libstd/rt.rs:59:19: 61:11
< goto -> bb5; // scope 4 at /home/ws/ca8159/Projects/rust/rust/src/libstd/rt.rs:59:19: 61:11
---
> Validate(Acquire, [_22: std::result::Result<(), std::boxed::Box<std::any::Any + std::marker::Send + 'static>>]); // scope 4 at /home/ws/ca8159/Projects/rust/rust/src/libstd/rt.rs:63:19: 63:71
> Validate(Release, [_22: std::result::Result<(), std::boxed::Box<std::any::Any + std::marker::Send + 'static>>]); // scope 4 at /home/ws/ca8159/Projects/rust/rust/src/libstd/rt.rs:63:19: 63:71
> StorageDead(_23); // scope 4 at /home/ws/ca8159/Projects/rust/rust/src/libstd/rt.rs:63:71: 63:71
> _25 = const std::sys_common::cleanup() -> [return: bb11, unwind: bb12]; // scope 5 at /home/ws/ca8159/Projects/rust/rust/src/libstd/rt.rs:64:9: 64:30 |
The working version seems to be a horribly old version: rust-lang/rust@ca8b754 (note the transmute in the working version) Is rustup somehow distributing old sources? |
Nevermind I'm stupid: https://github.com/rust-lang/rust/blame/master/src/libstd/rt.rs#L63 The backtrace features seems to be the difference... Checking what it does if given to xargo... |
@RalfJung That's it! We are reproducible now! |
92a4333
to
79f90d1
Compare
@RalfJung thanks for being so patient with me on this PR. Are you ok with merging the test disabling now that it's reproducible? |
This looks good! Thanks for digging to the bottom of this :) This makes me wonder if there are other features we should enable... |
With full mir and on master rustc miri fails with