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

crash while compiling pango 0.1.3 #49181

Closed
matthiaskrgr opened this issue Mar 19, 2018 · 5 comments · Fixed by #49210 or #49403
Closed

crash while compiling pango 0.1.3 #49181

matthiaskrgr opened this issue Mar 19, 2018 · 5 comments · Fixed by #49210 or #49403
Assignees
Labels
I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ regression-from-stable-to-nightly Performance or correctness regression from stable to nightly.

Comments

@matthiaskrgr
Copy link
Member

I was trying to build https://github.com/bvinc/gxi which pulls in pango 0.1.3 as dependency https://github.com/gtk-rs/pango .
While building pango, rustc segfaults

cd /tmp/
cargo new pango_crash --bin
cd pango_crash
echo "pango = \"0.1.3\"" >> Cargo.toml
RUST_BACKTRACE=1 cargo build --verbose

   Compiling pango v0.1.3
     Running `rustc --crate-name pango /home/matthias/.cargo/registry/src/github.com-1ecc6299db9ec823/pango-0.1.3/src/lib.rs --crate-type lib --emit=dep-info,link -C debuginfo=2 -C metadata=79ef8578d5682787 -C extra-filename=-79ef8578d5682787 --out-dir /tmp/pango_crash/target/debug/deps -L dependency=/tmp/pango_crash/target/debug/deps --extern libc=/tmp/pango_crash/target/debug/deps/liblibc-a4fb9588d5f009f2.rlib --extern glib=/tmp/pango_crash/target/debug/deps/libglib-b20a4586cffe6411.rlib --extern pango_sys=/tmp/pango_crash/target/debug/deps/libpango_sys-954f223c59579c4f.rlib --extern bitflags=/tmp/pango_crash/target/debug/deps/libbitflags-ace94e42abe55a1c.rlib --cap-lints allow -L native=/usr/lib -L native=/usr/lib -L native=/usr/lib`
thread 'rustc' panicked at 'called `Option::unwrap()` on a `None` value', libcore/option.rs:335:21
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
stack backtrace:
   0: std::sys::unix::backtrace::tracing::imp::unwind_backtrace
             at libstd/sys/unix/backtrace/tracing/gcc_s.rs:49
   1: std::sys_common::backtrace::print
             at libstd/sys_common/backtrace.rs:71
             at libstd/sys_common/backtrace.rs:59
   2: std::panicking::default_hook::{{closure}}
             at libstd/panicking.rs:207
   3: std::panicking::default_hook
             at libstd/panicking.rs:223
   4: core::ops::function::Fn::call
   5: std::panicking::rust_panic_with_hook
             at libstd/panicking.rs:403
   6: std::panicking::begin_panic_fmt
             at libstd/panicking.rs:349
   7: rust_begin_unwind
             at libstd/panicking.rs:325
   8: core::panicking::panic_fmt
             at libcore/panicking.rs:72
   9: core::panicking::panic
             at libcore/panicking.rs:51
  10: rustc_mir::hair::pattern::PatternContext::const_to_pat
  11: rustc_mir::hair::pattern::PatternContext::lower_path
  12: rustc_mir::hair::pattern::PatternContext::lower_pattern
  13: core::ops::function::impls::<impl core::ops::function::FnOnce<A> for &'a mut F>::call_once
  14: <alloc::vec::Vec<T> as alloc::vec::SpecExtend<T, I>>::from_iter
  15: <alloc::vec::Vec<T> as alloc::vec::SpecExtend<T, I>>::from_iter
  16: <rustc_mir::hair::pattern::check_match::MatchVisitor<'a, 'tcx> as rustc::hir::intravisit::Visitor<'tcx>>::visit_expr
  17: <rustc_mir::hair::pattern::check_match::MatchVisitor<'a, 'tcx> as rustc::hir::intravisit::Visitor<'tcx>>::visit_expr
  18: rustc::session::Session::track_errors
  19: rustc_mir::hair::pattern::check_match::check_match
  20: rustc::dep_graph::graph::DepGraph::with_task_impl
  21: rustc_errors::Handler::track_diagnostics
  22: rustc::ty::maps::plumbing::<impl rustc::ty::context::TyCtxt<'a, 'gcx, 'tcx>>::cycle_check
  23: rustc::ty::maps::<impl rustc::ty::maps::queries::check_match<'tcx>>::force
  24: rustc::ty::maps::<impl rustc::ty::maps::queries::check_match<'tcx>>::try_get
  25: rustc::ty::maps::TyCtxtAt::check_match
  26: rustc::ty::maps::<impl rustc::ty::context::TyCtxt<'a, 'tcx, 'lcx>>::check_match
  27: rustc::hir::intravisit::Visitor::visit_nested_body
  28: rustc::hir::Crate::visit_all_item_likes
  29: rustc_mir::hair::pattern::check_match::check_crate
  30: <std::thread::local::LocalKey<T>>::with
  31: <std::thread::local::LocalKey<T>>::with
  32: rustc::ty::context::TyCtxt::create_and_enter
  33: rustc_driver::driver::compile_input
  34: rustc_driver::run_compiler_impl
  35: syntax::with_globals
error: internal compiler error: unexpected panic
note: the compiler unexpectedly panicked. this is a bug.
note: we would appreciate a bug report: https://github.com/rust-lang/rust/blob/master/CONTRIBUTING.md#bug-reports
note: rustc 1.26.0-nightly (5508b2714 2018-03-18) running on x86_64-unknown-linux-gnu
note: compiler flags: -C debuginfo=2 --crate-type lib
note: some of the compiler flags provided by cargo are hidden
error: Could not compile `pango`.
Caused by:
  process didn't exit successfully: `rustc --crate-name pango /home/matthias/.cargo/registry/src/github.com-1ecc6299db9ec823/pango-0.1.3/src/lib.rs --crate-type lib --emit=dep-info,link -C debuginfo=2 -C metadata=79ef8578d5682787 -C extra-filename=-79ef8578d5682787 --out-dir /tmp/pango_crash/target/debug/deps -L dependency=/tmp/pango_crash/target/debug/deps --extern libc=/tmp/pango_crash/target/debug/deps/liblibc-a4fb9588d5f009f2.rlib --extern glib=/tmp/pango_crash/target/debug/deps/libglib-b20a4586cffe6411.rlib --extern pango_sys=/tmp/pango_crash/target/debug/deps/libpango_sys-954f223c59579c4f.rlib --extern bitflags=/tmp/pango_crash/target/debug/deps/libbitflags-ace94e42abe55a1c.rlib --cap-lints allow -L native=/usr/lib -L native=/usr/lib -L native=/usr/lib` (exit code: 101)

meta:

rustc 1.26.0-nightly (5508b2714 2018-03-18)
binary: rustc
commit-hash: 5508b27145cfb82896ae838e6aca0cd48750796f
commit-date: 2018-03-18
host: x86_64-unknown-linux-gnu
release: 1.26.0-nightly
LLVM version: 6.0
@sanxiyn sanxiyn added the I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ label Mar 20, 2018
@oli-obk oli-obk self-assigned this Mar 20, 2018
@oli-obk
Copy link
Contributor

oli-obk commented Mar 20, 2018

Crash happens in https://github.com/rust-lang/rust/blob/9b15ddb/src/librustc_mir/hair/pattern/mod.rs#L857-L860

So apparently const eval produces a discriminant that doesn't match any variant's discriminant.

more concretely, it happens during a match on https://github.com/gtk-rs/sys/blob/af83826e0a31f68bcddee17d3791fb01453dc632/pango-sys/src/lib.rs#L222 which is the only discriminant with -1 as its value.

@oli-obk oli-obk added the regression-from-stable-to-nightly Performance or correctness regression from stable to nightly. label Mar 22, 2018
bors added a commit that referenced this issue Mar 22, 2018
Fix the conversion between bit representations and i128 representations

fixes #49181

the `Discr` type now encodes the bit representation instead of `i128` or `u128` casted to `u128`.

r? @eddyb
@matthiaskrgr
Copy link
Member Author

@oli-obk weird, I am still getting the panic with todays nightly rustc 1.26.0-nightly (c08480fce 2018-03-23) :(

@oli-obk oli-obk reopened this Mar 24, 2018
@oli-obk
Copy link
Contributor

oli-obk commented Mar 24, 2018

Same backtrace? We do have a regression test for this exact issue

@matthiaskrgr
Copy link
Member Author

Yeah, backtrace is identical except for the rustc version string in the ICE notes. :/

bors added a commit that referenced this issue Mar 30, 2018
Trim discriminants to their final type size

r? @eddyb

fixes  #49181
@matthiaskrgr
Copy link
Member Author

Fix confirmed, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ regression-from-stable-to-nightly Performance or correctness regression from stable to nightly.
Projects
None yet
3 participants