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

Compiler panic: bpos.to_usize() >= mbc.pos.to_usize() + mbc.bytes #46773

Closed
delehef opened this issue Dec 16, 2017 · 2 comments
Closed

Compiler panic: bpos.to_usize() >= mbc.pos.to_usize() + mbc.bytes #46773

delehef opened this issue Dec 16, 2017 · 2 comments
Labels
I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️

Comments

@delehef
Copy link

delehef commented Dec 16, 2017

rustc --version --verbose
=========================

rustc 1.24.0-nightly (77efd6800 2017-12-15)
binary: rustc
commit-hash: 77efd6800c57ba83923dddbbabf03c7afa6a34a4
commit-date: 2017-12-15
host: x86_64-unknown-linux-gnu
release: 1.24.0-nightly
LLVM version: 4.0

rustc panics with the following backtrace:

thread 'rustc' panicked at 'assertion failed: bpos.to_usize() >= mbc.pos.to_usize() + mbc.bytes', /checkout/src/libsyntax/codemap.rs:586:16
stack backtrace:
   0:     0x7f288d0be2cb - std::sys::unix::backtrace::tracing::imp::unwind_backtrace::hf03debd250282e5d
                               at /checkout/src/libstd/sys/unix/backtrace/tracing/gcc_s.rs:49
   1:     0x7f288d0b61fe - std::sys_common::backtrace::print::hc2b1571ec4035b57
                               at /checkout/src/libstd/sys_common/backtrace.rs:68
                               at /checkout/src/libstd/sys_common/backtrace.rs:57
   2:     0x7f288d0c7590 - std::panicking::default_hook::{{closure}}::hbb73a80a69f92519
                               at /checkout/src/libstd/panicking.rs:381
   3:     0x7f288d0c728b - std::panicking::default_hook::hcff6bf77544d5956
                               at /checkout/src/libstd/panicking.rs:391
   4:     0x7f288d0c7a6b - std::panicking::rust_panic_with_hook::h414a68738005788f
                               at /checkout/src/libstd/panicking.rs:577
   5:     0x7f2887d99863 - std::panicking::begin_panic::hf89d9d83300ab923
   6:     0x7f2888008e82 - syntax::codemap::CodeMap::bytepos_to_file_charpos::h05cb956309f8610a
   7:     0x7f288800644f - syntax::codemap::CodeMap::lookup_char_pos::hfa0c0a7f87d3c8bf
   8:     0x7f288800730a - syntax::codemap::CodeMap::span_to_filename::h7ba024b765fb18a4
   9:     0x7f2888009188 - <syntax::codemap::CodeMap as rustc_errors::CodeMapper>::span_to_filename::h76575b8deb828350
  10:     0x7f2887aaa686 - rustc_errors::emitter::EmitterWriter::fix_multispan_in_std_macros::h5c5d0294a14a3b1d
  11:     0x7f2887aa6a56 - <rustc_errors::emitter::EmitterWriter as rustc_errors::emitter::Emitter>::emit::h827806157bd8e50d
  12:     0x7f2887ab8c44 - rustc_errors::Handler::emit_db::hdf22b8fa97bffc91
  13:     0x7f2887aa036d - rustc_errors::diagnostic_builder::DiagnosticBuilder::emit::h82d0bf9edc975904
  14:     0x7f288b00815d - rustc_borrowck::borrowck::check_loans::CheckLoanCtxt::report_error_if_loans_conflict::he15fb3fbd96594b0
  15:     0x7f288aff1a76 - <rustc::middle::dataflow::DataFlowContext<'a, 'tcx, O>>::each_bit_on_entry::h22cfa9abf7662a2b
  16:     0x7f288b00766b - <rustc_borrowck::borrowck::check_loans::CheckLoanCtxt<'a, 'tcx> as rustc::middle::expr_use_visitor::Delegate<'tcx>>::borrow::h13af95cc19c1ed24
  17:     0x7f288920274d - rustc::middle::expr_use_visitor::ExprUseVisitor::walk_expr::h2043d4449837b4ee
  18:     0x7f288920383e - rustc::middle::expr_use_visitor::ExprUseVisitor::walk_expr::h2043d4449837b4ee
  19:     0x7f2889202ad1 - rustc::middle::expr_use_visitor::ExprUseVisitor::walk_expr::h2043d4449837b4ee
  20:     0x7f28892030c9 - rustc::middle::expr_use_visitor::ExprUseVisitor::walk_expr::h2043d4449837b4ee
  21:     0x7f28892030bd - rustc::middle::expr_use_visitor::ExprUseVisitor::walk_expr::h2043d4449837b4ee
  22:     0x7f28892028f1 - rustc::middle::expr_use_visitor::ExprUseVisitor::walk_expr::h2043d4449837b4ee
  23:     0x7f2889203021 - rustc::middle::expr_use_visitor::ExprUseVisitor::walk_expr::h2043d4449837b4ee
  24:     0x7f2889202eec - rustc::middle::expr_use_visitor::ExprUseVisitor::walk_expr::h2043d4449837b4ee
  25:     0x7f2889203ae2 - rustc::middle::expr_use_visitor::ExprUseVisitor::walk_local::h7254fd9416a0b3f4
  26:     0x7f2889202914 - rustc::middle::expr_use_visitor::ExprUseVisitor::walk_expr::h2043d4449837b4ee
  27:     0x7f28892030c9 - rustc::middle::expr_use_visitor::ExprUseVisitor::walk_expr::h2043d4449837b4ee
  28:     0x7f2889203021 - rustc::middle::expr_use_visitor::ExprUseVisitor::walk_expr::h2043d4449837b4ee
  29:     0x7f2889202eec - rustc::middle::expr_use_visitor::ExprUseVisitor::walk_expr::h2043d4449837b4ee
  30:     0x7f2889203ae2 - rustc::middle::expr_use_visitor::ExprUseVisitor::walk_local::h7254fd9416a0b3f4
  31:     0x7f2889202914 - rustc::middle::expr_use_visitor::ExprUseVisitor::walk_expr::h2043d4449837b4ee
  32:     0x7f28892028f1 - rustc::middle::expr_use_visitor::ExprUseVisitor::walk_expr::h2043d4449837b4ee
  33:     0x7f288b007ead - rustc_borrowck::borrowck::check_loans::check_loans::hf65b6e2d7f341e6b
  34:     0x7f288b011af2 - rustc_borrowck::borrowck::borrowck::h55097c950cdf8de8
  35:     0x7f288908a1a2 - rustc::dep_graph::graph::DepGraph::with_task_impl::hc936e4888d26fd84
  36:     0x7f2888d7928e - rustc_errors::Handler::track_diagnostics::hb7e3dbdf5a363cd7
  37:     0x7f2888c822c0 - rustc::ty::maps::plumbing::<impl rustc::ty::context::TyCtxt<'a, 'gcx, 'tcx>>::cycle_check::hd0785b60d313bd66
  38:     0x7f2889118aa2 - rustc::ty::maps::<impl rustc::ty::maps::queries::borrowck<'tcx>>::force::h21c9a049284db670
  39:     0x7f2889119220 - rustc::ty::maps::<impl rustc::ty::maps::queries::borrowck<'tcx>>::try_get::h696a9faacabc8bae
  40:     0x7f2888f3dc4a - rustc::ty::maps::TyCtxtAt::borrowck::h838bd68468de71a5
  41:     0x7f2888ca6870 - rustc::ty::maps::<impl rustc::ty::context::TyCtxt<'a, 'tcx, 'lcx>>::borrowck::h708b97814046c0a4
  42:     0x7f288b0113df - rustc_borrowck::borrowck::check_crate::h449a99ff1a4ce179
  43:     0x7f288d5033e8 - <std::thread::local::LocalKey<T>>::with::h4fd1ef26c0a5991b
  44:     0x7f288d5086a6 - <std::thread::local::LocalKey<T>>::with::hcf2ee49dc727d320
  45:     0x7f288d55eaac - rustc::ty::context::TyCtxt::create_and_enter::h5b7a23885092ff7b
  46:     0x7f288d4b3f70 - rustc_driver::driver::compile_input::h25bdc15f9a01b342
  47:     0x7f288d539ea8 - rustc_driver::run_compiler::h1ec6f4bd93a58850
  48:     0x7f288d511941 - std::sys_common::backtrace::__rust_begin_short_backtrace::hdcf43b2f9f3b4406
  49:     0x7f288d0fca5e - __rust_maybe_catch_panic
                               at /checkout/src/libpanic_unwind/lib.rs:101
  50:     0x7f288d528bb2 - <F as alloc::boxed::FnBox<A>>::call_box::hd509f195fdeaea34
  51:     0x7f288d0b8b77 - std::sys_common::thread::start_thread::h706ddf8f441bf6eb
                               at /checkout/src/liballoc/boxed.rs:827
  52:     0x7f288d0d3288 - std::sys::unix::thread::Thread::new::thread_start::h51e87d4de9fb4e14
                               at /checkout/src/libstd/sys/unix/thread.rs:90
  53:     0x7f2886dfa567 - start_thread
                               at /builddir/glibc-2.26/nptl/pthread_create.c:465
  54:     0x7f288cda752e - clone
                               at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95
  55:                0x0 - <unknown>

error: Could not compile `msa`.

Unfortunately, although it compiles nicely on stable, I can't publish the code yet; so I'm not sure this bug report is actually useful :/

@arielb1 arielb1 changed the title Compiler panic Compiler panic: bpos.to_usize() >= mbc.pos.to_usize() + mbc.bytes Dec 17, 2017
@sfackler sfackler added the I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ label Dec 17, 2017
@dwrensha
Copy link
Contributor

Here's a tiny program that reproduces the problem:

$ echo -n "fn eq (brnӍБ" > /tmp/bug.rs
$ RUST_BACKTRACE=1 rustc /tmp/bug.rs  
error: this file contains an un-closed delimiter
 --> /tmp/bug.rs:1:13
  |
1 | fn eq (brnӍБ
  |             ^
  |
help: did you mean to close this delimiter?
 --> /tmp/bug.rs:1:7
  |
1 | fn eq (brnӍБ
  |       ^

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.25.0-nightly (ae920dcc9 2018-01-22) running on x86_64-unknown-linux-gnu

note: run with `RUST_BACKTRACE=1` for a backtrace

thread 'rustc' panicked at 'assertion failed: bpos.to_usize() >= mbc.pos.to_usize() + mbc.bytes', libsyntax/codemap.rs:644:17
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:68
             at libstd/sys_common/backtrace.rs:57
   2: std::panicking::default_hook::{{closure}}
             at libstd/panicking.rs:380
   3: std::panicking::default_hook
             at libstd/panicking.rs:390
   4: std::panicking::rust_panic_with_hook
             at libstd/panicking.rs:576
   5: std::panicking::begin_panic
   6: syntax::codemap::CodeMap::bytepos_to_file_charpos
   7: syntax::codemap::CodeMap::lookup_char_pos
   8: syntax::codemap::CodeMap::span_to_filename
   9: <syntax::codemap::CodeMap as rustc_errors::CodeMapper>::call_span_if_macro
  10: rustc_errors::emitter::EmitterWriter::fix_multispan_in_std_macros
  11: <rustc_errors::emitter::EmitterWriter as rustc_errors::emitter::Emitter>::emit
  12: rustc_errors::Handler::emit_db
  13: rustc_errors::diagnostic_builder::DiagnosticBuilder::emit
  14: syntax::parse::parser::Parser::parse_fn_args::{{closure}}
  15: syntax::parse::parser::Parser::parse_fn_args
  16: syntax::parse::parser::Parser::parse_fn_decl
  17: syntax::parse::parser::Parser::parse_item_fn
  18: syntax::parse::parser::Parser::parse_item_
  19: syntax::parse::parser::Parser::parse_item
  20: syntax::parse::parser::Parser::parse_mod_items
  21: syntax::parse::parser::Parser::parse_crate_mod
  22: syntax::parse::parse_crate_from_file
  23: rustc_driver::driver::phase_1_parse_input::{{closure}}
  24: rustc::util::common::time
  25: rustc_driver::driver::phase_1_parse_input
  26: rustc_driver::driver::compile_input
  27: rustc_driver::run_compiler

@estebank
Copy link
Contributor

Closing as duplicate of #48508 (which will be fixed shortly in #48522).

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) ❄️
Projects
None yet
Development

No branches or pull requests

4 participants