Skip to content
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

Internal compiler error: broken MIR in gecko_bindings #42042

Closed
rillian opened this issue May 16, 2017 · 17 comments
Closed

Internal compiler error: broken MIR in gecko_bindings #42042

rillian opened this issue May 16, 2017 · 17 comments
Labels
regression-from-stable-to-beta Performance or correctness regression from stable to beta. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@rillian
Copy link
Contributor

rillian commented May 16, 2017

Rust 1.18.0-beta.2 (f4e8e81 2017-05-11) fails to compile some stylo code in Firefox:

 6:27.45 error[E0161]: cannot move a value of type [gecko_bindings::structs::root::nsStyleCoord]: the size of [gecko_bindings::structs::root::nsStyleCoord] cannot be statically determined
 6:27.45     --> /home/giles/firefox/obj-x86_64-pc-linux-gnu/toolkit/library/x86_64-unknown-linux-gnu/debug/build/style-9cea8a5ed5bf5b1e/out/gecko_properties.rs:8177:29
 6:27.45      |
 6:27.45 8177 |                             shape.mCoordinates[2 * i].leaky_set_null();
 6:27.45      |                             ^^^^^^^^^^^^^^^^^^
 6:27.45 
 6:27.45 error[E0161]: cannot move a value of type [gecko_bindings::structs::root::nsStyleCoord]: the size of [gecko_bindings::structs::root::nsStyleCoord] cannot be statically determined
 6:27.45     --> /home/giles/firefox/obj-x86_64-pc-linux-gnu/toolkit/library/x86_64-unknown-linux-gnu/debug/build/style-9cea8a5ed5bf5b1e/out/gecko_properties.rs:8178:29
 6:27.45      |
 6:27.45 8178 |                             shape.mCoordinates[2 * i + 1].leaky_set_null();
 6:27.45      |                             ^^^^^^^^^^^^^^^^^^
 6:27.45 
 6:27.45 error: internal compiler error: broken MIR (Terminator { source_info: SourceInfo { span: /home/giles/firefox/obj-x86_64-pc-linux-gnu/toolkit/library/x86_64-unknown-linux-gnu/debug/build/style-9cea8a5ed5bf5b1e/out/gecko_properties.rs:8177:29: 8177:54, scope: scope16 }, kind: _179 = const std::ops::Index::index(_180, _183) -> [return: bb87, unwind: bb21] }): bad arg #0 (&[gecko_bindings::structs::root::nsStyleCoord] <- [gecko_bindings::structs::root::nsStyleCoord]): Sorts(ExpectedFound { expected: &[gecko_bindings::structs::root::nsStyleCoord], found: [gecko_bindings::structs::root::nsStyleCoord] })
[...]
 6:28.22 note: the compiler unexpectedly panicked. this is a bug.
 6:28.22 
 6:28.22 note: we would appreciate a bug report: https://github.com/rust-lang/rust/blob/master/CONTRIBUTING.md#bug-reports
 6:28.22 
 6:28.22 note: run with `RUST_BACKTRACE=1` for a backtrace
 6:28.22 
 6:28.22 thread 'rustc' panicked at 'Box<Any>', /checkout/src/librustc_errors/lib.rs:375
 6:28.22 stack backtrace:
 6:28.22    0: std::sys::imp::backtrace::tracing::imp::unwind_backtrace
 6:28.22              at /checkout/src/libstd/sys/unix/backtrace/tracing/gcc_s.rs:49
 6:28.22    1: std::sys_common::backtrace::_print
 6:28.23              at /checkout/src/libstd/sys_common/backtrace.rs:71
 6:28.23    2: std::panicking::default_hook::{{closure}}
 6:28.23              at /checkout/src/libstd/sys_common/backtrace.rs:60
 6:28.23              at /checkout/src/libstd/panicking.rs:355
 6:28.23    3: std::panicking::default_hook
 6:28.23              at /checkout/src/libstd/panicking.rs:365
 6:28.23    4: std::panicking::rust_panic_with_hook
 6:28.23              at /checkout/src/libstd/panicking.rs:549
 6:28.23    5: std::panicking::begin_panic
 6:28.23    6: rustc_errors::Handler::span_bug
 6:28.24    7: rustc_mir::transform::type_check::TypeChecker::check_terminator
 6:28.24    8: rustc::infer::InferCtxtBuilder::enter
 6:28.24    9: <rustc_mir::transform::type_check::TypeckMir as rustc::mir::transform::MirPass<'tcx>>::run_pass
 6:28.24   10: <T as rustc::mir::transform::MirMapPass<'tcx>>::run_pass
 6:28.24   11: rustc::mir::transform::Passes::run_passes
 6:28.24   12: rustc_driver::driver::phase_3_run_analysis_passes::{{closure}}::{{closure}}
 6:28.24   13: rustc_driver::driver::phase_3_run_analysis_passes::{{closure}}
 6:28.24   14: rustc::ty::context::TyCtxt::create_and_enter
 6:28.24   15: rustc_driver::driver::phase_3_run_analysis_passes
 6:28.24   16: rustc_driver::driver::compile_input
 6:28.24   17: rustc_driver::run_compiler
 6:28.24   18: std::panicking::try::do_call
 6:28.24   19: __rust_maybe_catch_panic
 6:28.24              at /checkout/src/libpanic_unwind/lib.rs:98
 6:28.24   20: <F as alloc::boxed::FnBox<A>>::call_box
 6:28.24   21: std::sys::imp::thread::Thread::new::thread_start
 6:28.24              at /checkout/src/liballoc/boxed.rs:650
 6:28.24              at /checkout/src/libstd/sys_common/thread.rs:21
 6:28.24              at /checkout/src/libstd/sys/unix/thread.rs:84
 6:28.24   22: start_thread
 6:28.24   23: clone
 6:28.24 
 6:28.24 error: Could not compile `style`.
 6:28.24 
 6:28.24 To learn more, run the command again with --verbose.
 6:28.24 /home/giles/firefox/config/rules.mk:1020: recipe for target 'force-cargo-library-build' failed
 6:28.24 gmake[5]: *** [force-cargo-library-build] Error 101
 6:28.24 /home/giles/firefox/config/recurse.mk:73: recipe for target 'toolkit/library/rust/target' failed

This is yesterday's firefox master with --enable-stylo.

$ rustc --version --verbose
rustc 1.18.0-beta.2 (f4e8e81c3 2017-05-11)
binary: rustc
commit-hash: f4e8e81c34e7c378fc230b589623aaaf94bd17a7
commit-date: 2017-05-11
host: x86_64-unknown-linux-gnu
release: 1.18.0-beta.2
LLVM version: 3.9

See https://treeherder.mozilla.org/#/jobs?repo=try&revision=86ebd4aa3836&selectedJob=99289427 for a full build example.

@alexcrichton
Copy link
Member

cc @rust-lang/compiler

@alexcrichton alexcrichton added regression-from-stable-to-beta Performance or correctness regression from stable to beta. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels May 16, 2017
@rillian
Copy link
Contributor Author

rillian commented May 16, 2017

I tried 1.19.0-nightly, but we hit #41620 before we get to this part of the build. I'll see if I can reduce a test case later today.

@eddyb
Copy link
Member

eddyb commented May 16, 2017

Are the errors legitimate? i.e. is this just a case of ICE-on-error?

@rillian
Copy link
Contributor Author

rillian commented May 16, 2017

I don't know, actually. It's complaining about non-static size computing an array offset, but earlier accesses with a static offsets are accepted, which seems bogus to me. i.e. shape.mCoordinates[1] is fine but shape.mCoordinates[2 * i] is not.

@eddyb
Copy link
Member

eddyb commented May 16, 2017

cc @arielb1 Does this look like a bug you fixed on nightly and hasn't been backported yet?

@arielb1
Copy link
Contributor

arielb1 commented May 16, 2017

That bug only looked like it affected failed compilations, but some variant might be affecting running ones.

@rillian
Copy link
Contributor Author

rillian commented May 17, 2017

I've extracted enough of the relevant code to build a testcase. This compiles on 1.17-stable and 1.19-nightly, but generates a warning and then an ICE in 1.18.0-beta.2.

It can probably be reduced further, but the issue was in a large collection of generated bindings and custom glue for a large C++ library, and this as least demonstrates the problem without having to build firefox.

@est31
Copy link
Member

est31 commented May 17, 2017

Minimized:

struct C([S; 1]);

impl std::ops::Deref for C {
    type Target = [S];

    fn deref<'a>(&'a self) -> &'a [S] { &self.0 }
}

impl std::ops::DerefMut for C {
    fn deref_mut<'a>(&'a mut self) -> &'a mut [S] { &mut self.0 }
}

struct S {}
impl S {
    fn foo(&mut self) {}
}

fn main() {
    let mut c = C([S {}]);
    c[0*0].foo();
}

Same properties as the example by @rillian above: it compiles on stable and nightly, but gives an error and ICE on beta.

@est31
Copy link
Member

est31 commented May 17, 2017

The example looks very similar to this one of issue #41604. Issue #41944 says that its fixed on nightly as well, but not on beta. @arielb1 do you think this issue is a dupe?

@arielb1
Copy link
Contributor

arielb1 commented May 17, 2017

Yeah. Let's see whether it is fixed after backporting before we close it.

@rillian
Copy link
Contributor Author

rillian commented May 17, 2017

Thanks, @est31 and @arielb1!

@est31
Copy link
Member

est31 commented May 23, 2017

PR #42053 with a backport of the suspected fix #41651 just landed on the beta branch. It should be less than 24 hours until its available on the rustup beta channel so that it can be used for re-evaluation of this issue.

@est31
Copy link
Member

est31 commented May 23, 2017

Oh seems I've misunderstood the mechanism. We need to wait for a new version bump of the beta, which will happen in PR #42161.

@est31
Copy link
Member

est31 commented May 24, 2017

The PR is merged. I can confirm that the minimized example I posted above is fixed on latest beta 1.18.0-beta.3 (139d12f52 2017-05-23).

@Mark-Simulacrum
Copy link
Member

@rillian Could you check if we can compile fine on beta today?

@rillian
Copy link
Contributor Author

rillian commented May 24, 2017

1.18.0-beta.3 resolves the issue on my local machine. I'm waiting for ci tests to confirm other platforms.

@rillian
Copy link
Contributor Author

rillian commented May 24, 2017

The Window 2012 x64 job is having unrelated issues, but otherwise the try push was green, so I think this is resolved for us too. Thanks again for your help!

https://treeherder.mozilla.org/#/jobs?repo=try&revision=db2dda574de48fd4c176b9caa7e08e2135f3cf06

@rillian rillian closed this as completed May 24, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
regression-from-stable-to-beta Performance or correctness regression from stable to beta. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

7 participants