rust-lang / rust

Empowering everyone to build reliable and efficient software.
https://www.rust-lang.org
Other
98.99k stars 12.79k forks source link

ICE: failed to find block with tag 7 #12919

Closed mikedilger closed 10 years ago

mikedilger commented 10 years ago
failed to find block with tag 7
error: internal compiler error: unexpected failure
note: the compiler hit an unexpected failure path. this is a bug.
note: we would appreciate a bug report: http://static.rust-lang.org/doc/master/complement-bugreport.html
note: run with `RUST_LOG=std::rt::backtrace` for a backtrace
task 'rustc' failed at 'explicit failure', /usr/local/git/rust/src/libserialize/ebml.rs:209

The following simple code triggers this:

fn main() {
    println!("{}", ::std::num::Float::to_radians(200));
}
alexcrichton commented 10 years ago

Backtrace:

stack backtrace:
   1:        0x109058e24 - rt::backtrace::imp::write::hfa85d935515fa091H7b::v0.10.pre
   2:        0x108fbfacf - rt::unwind::begin_unwind_inner::h8735c5227cfd9f1amJb::v0.10.pre
   3:        0x10965c138 - rt::unwind::begin_unwind::hc31d0b0f241434a1esh::v0.10.pre
   4:        0x10965ca7f - ebml::reader::get_doc::he26c369f84478341t3b::v0.10.pre
   5:        0x10a43a3b8 - metadata::decoder::item_type::h8daef610f3fb88cdKr6::v0.10.pre
   6:        0x10a43cbdf - metadata::decoder::get_type::h57b237ef16a367cfqE6::v0.10.pre
   7:        0x109e64c20 - metadata::csearch::get_type::h2718b15d094426f4VU8::v0.10.pre
   8:        0x109e042f0 - middle::ty::lookup_item_type::hdaca3fecb6c5407473O::v0.10.pre
   9:        0x10a0c6b89 - middle::typeck::check::ty_param_bounds_and_ty_for_def::hf13906bb637bd910Bla::v0.10.pre
  10:        0x10a0b8a14 - middle::typeck::check::check_expr_with_unifier::hc1cd91fca16a95dcfI7::v0.10.pre
  11:        0x10a0b1091 - middle::typeck::check::check_expr_with_unifier::hc1cd91fca16a95dcfI7::v0.10.pre
  12:        0x10a0b3499 - middle::typeck::check::check_expr_with_unifier::hc1cd91fca16a95dcfI7::v0.10.pre
  13:        0x10a0b4caa - middle::typeck::check::check_expr_with_unifier::hc1cd91fca16a95dcfI7::v0.10.pre
  14:        0x10a014bb4 - middle::typeck::check::check_expr_has_type::h52eed52b8cc7335bIi7::v0.10.pre
  15:        0x10a013059 - middle::typeck::check::_match::check_match::h2571b6f9ae555c686oY::v0.10.pre
  16:        0x10a0b22c9 - middle::typeck::check::check_expr_with_unifier::hc1cd91fca16a95dcfI7::v0.10.pre
  17:        0x10a0c8426 - middle::typeck::check::check_stmt::h7d320e3672611a2fgU9::v0.10.pre
  18:        0x10a09006c - middle::typeck::check::check_block_with_expected::h205bee4d620cdb47vY9::v0.10.pre
  19:        0x10a08bcd6 - middle::typeck::check::check_fn::h6d371c3826d8a15eaK5::v0.10.pre
  20:        0x10a08b5ea - middle::typeck::check::check_bare_fn::h40f74565d81b7d5dAA5::v0.10.pre
  21:        0x10a0868f8 - middle::typeck::check::check_item::h117c17b02dda6a221T5::v0.10.pre
  22:        0x10a08b3d1 - middle::typeck::check::check_item_types::h1b456e65056a83d0aA5::v0.10.pre
  23:        0x10a17e77f - util::common::time::h2901a4308783fc57AYc::v0.10.pre
  24:        0x10a17d7ba - middle::typeck::check_crate::h9742c1b4a5a2c844Zvr::v0.10.pre
  25:        0x10a4bad36 - driver::driver::phase_3_run_analysis_passes::hea6d0f4382a7b523WOa::v0.10.pre
  26:        0x10a4c170b - driver::driver::compile_input::h11f8f93e05a14bba2bb::v0.10.pre
  27:        0x10a4e60a6 - run_compiler::h72f96d057d3187detNi::v0.10.pre
  28:        0x10a4f5fbd - main_args::closure.87110
  29:        0x10a4f47d2 - monitor::closure.86995
  30:        0x10a4f044b - task::TaskBuilder::try::closure.86809
  31:        0x10bef57ec - task::spawn_opts::closure.7463
  32:        0x109052788 - rt::task::Task::run::closure.40598
  33:        0x10905ec4c - rust_try
  34:        0x109052607 - rt::task::Task::run::h864be4fde5c5940cqf9::v0.10.pre
  35:        0x10bef566b - task::spawn_opts::closure.7435
  36:        0x109055d46 - rt::thread::thread_start::he456f4de670475e84V9::v0.10.pre
  37:     0x7fff8a5b0899 - _pthread_body
  38:     0x7fff8a5b072a - _pthread_struct_init

(seems to be related to typechecking)

morrowa commented 10 years ago

I appear to have hit this same bug in trying to cross-compile for ARMhf.

https://gist.github.com/morrowa/9877503

EDIT: The code I'm trying to compile is here: https://github.com/morrowa/tahoe-pi/tree/52b63bdfca6830ede5c597f7b95c2d90acb71328

mrmonday commented 10 years ago

Here's a reduced testcase:

fn main() {
    let data = 0u;
    let len = 0u;
    let slice = Slice { data: data, len: len };
}

Playpen: http://is.gd/oi9ALc Backtrace:

ERROR:rbml::reader: failed to find block with tag 7
error: internal compiler error: unexpected failure
note: the compiler hit an unexpected failure path. this is a bug.
note: we would appreciate a bug report: http://doc.rust-lang.org/complement-bugreport.html
note: run with `RUST_BACKTRACE=1` for a backtrace
task 'rustc' failed at 'explicit failure', /home/robert/rust/src/librbml/lib.rs:246

stack backtrace:
   1:     0x7fb8a01f7d20 - rt::backtrace::imp::write::h3bf50c6342044859pxr
   2:     0x7fb8a01fadf0 - failure::on_fail::hf2af25ddfb61c6166Sr
   3:     0x7fb8a09d5570 - unwind::begin_unwind_inner::h270bb14ed5ac9f3bDje
   4:     0x7fb89d27e1e0 - unwind::begin_unwind::h6560570121837697204
   5:     0x7fb89d27d210 - reader::get_doc::h237bf80ea65bd6f7nSa
   6:     0x7fb8a164d370 - metadata::decoder::get_type::h63ccb7ae3ad1b1c6BCu
   7:     0x7fb8a108b5e0 - middle::ty::lookup_item_type::hb024590ac0e678bcqRI
   8:     0x7fb8a13e8dd0 - middle::typeck::check::check_expr_with_unifier::he78a23726fbcaf50DxW
   9:     0x7fb8a1448740 - middle::typeck::check::check_decl_local::heef8e1b61c708c61EAY
  10:     0x7fb8a1448960 - middle::typeck::check::check_stmt::h8de414f234b1a15bMCY
  11:     0x7fb8a13b2c70 - middle::typeck::check::check_block_with_expected::h17706bf76c83a2f8ZGY
  12:     0x7fb8a13aea00 - middle::typeck::check::check_fn::h064a0d44e9dce305oOT
  13:     0x7fb8a13ae720 - middle::typeck::check::check_bare_fn::hc2b8bc7e443848ff3CT
  14:     0x7fb8a13a7880 - middle::typeck::check::check_item::h73a8feb360d03f6ebcU
  15:     0x7fb8a13ae520 - middle::typeck::check::check_item_types::hecc74b4cd245d819kCT
  16:     0x7fb8a0dbb9a0 - util::common::time::h15153310036782750645
  17:     0x7fb8a15bc150 - middle::typeck::check_crate::hed3fed93a6fab9e6Nfl
  18:     0x7fb8a1689d00 - driver::driver::phase_3_run_analysis_passes::h83579db2878d0392UQz
  19:     0x7fb8a1684e40 - driver::driver::compile_input::h5f1cded471f161260Cz
  20:     0x7fb8a1733380 - driver::run_compiler::hf3375986adbeb8b5UaD
  21:     0x7fb8a1733290 - driver::main_args::closure.137700
  22:     0x7fb8a1745cc0 - task::TaskBuilder<S>::try_future::closure.138861
  23:     0x7fb8a1745ac0 - task::TaskBuilder<S>::spawn_internal::closure.138838
  24:     0x7fb8a2195730 - task::spawn_opts::closure.8450
  25:     0x7fb8a0a372a0 - rust_try_inner
  26:     0x7fb8a0a37290 - rust_try
  27:     0x7fb8a09d2bd0 - unwind::try::h461f8c6e0791ff8aT7d
  28:     0x7fb8a09d2970 - task::Task::run::h33f4c45a9024a975ded
  29:     0x7fb8a21954f0 - task::spawn_opts::closure.8396
  30:     0x7fb8a09d47b0 - thread::thread_start::hc36a7b331026829dZCd
  31:     0x7fb89fc87fe0 - start_thread
  32:     0x7fb8a069e019 - __clone
  33:                0x0 - <unknown>
mrmonday commented 10 years ago

Reduced further:

trait Foo {}

fn main() {
    let _ = Foo { val: 0 };
}

Playpen: http://is.gd/VtF6b6

This seems to occur when you attempt to use struct initialiser syntax with traits. The solution for my previous example is to explictly use std::raw::Slice; so that the struct is used rather than the built in trait.

schmee commented 10 years ago

@mrmonday test case above results in a different ICE on a more recent version (5fb2dfaa200f2cb32e77c54ae8a5e0f4823b65c8):

error: internal compiler error: unexpected failure
note: the compiler hit an unexpected failure path. this is a bug.
note: we would appreciate a bug report: http://doc.rust-lang.org/complement-bugreport.html
note: run with `RUST_BACKTRACE=1` for a backtrace
task 'rustc' failed at 'No def'n found for syntax::ast::DefId{krate: 0u32, node: 4u32} in tcx.tcache', /build/rust-git/src/rust/src/librustc/middle/ty.rs:3845
Kimundi commented 10 years ago

The prior error messages and backtraces all sound like an meta data problem, eg something encodes or decodes not correct. They got triggered because the examples used generics, and thus read metadata. The last example seems to be an unrelated ICE though.

ghost commented 10 years ago

We have tests for traits being mistakenly used in struct expressions, so closing.