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

ICE in codemap::CodeMap::bytepos_to_file_charpos #24687

Closed
nwin opened this issue Apr 22, 2015 · 8 comments · Fixed by #24932
Closed

ICE in codemap::CodeMap::bytepos_to_file_charpos #24687

nwin opened this issue Apr 22, 2015 · 8 comments · Fixed by #24932
Labels
I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️

Comments

@nwin
Copy link
Contributor

nwin commented Apr 22, 2015

I’m getting an ICE when compiling https://github.com/nwin/gif/tree/cef32bb49589ff55135745b23ac54978ee6edecf using cargo test

$ rustc --version
$ rustc 1.0.0-nightly (abf0548b5 2015-04-15) (built 2015-04-15)

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: run with `RUST_BACKTRACE=1` for a backtrace
thread 'rustc' panicked at 'assertion failed: bpos.to_usize() >= mbc.pos.to_usize() + mbc.bytes', /Users/rustbuild/src/rust-buildbot/slave/nightly-dist-rustc-mac/build/src/libsyntax/codemap.rs:780

stack backtrace:
   1:        0x10eb11f2f - sys::backtrace::write::ha929f94fedfba769pSs
   2:        0x10eb1a532 - panicking::on_panic::h99f1d335a08c6040yQw
   3:        0x10ead0765 - rt::unwind::begin_unwind_inner::h9ae94a4551603e31hyw
   4:        0x10e1ee09f - rt::unwind::begin_unwind::h936509937193573473
   5:        0x10e27821a - codemap::CodeMap::bytepos_to_file_charpos::h894b029e4291f71eRlA
   6:        0x10e27628e - codemap::CodeMap::lookup_char_pos::h85ee94f5ab885dffmcA
   7:        0x10b864989 - trans::debuginfo::set_source_location::he11b794ea5b45de1CQw
   8:        0x10b87f154 - trans::expr::trans_unadjusted::hb4afd18239032dc7GuA
   9:        0x10b7b227f - trans::expr::trans::hd8cdbc15463fe10aN7z
  10:        0x10b85356a - trans::expr::trans_to_lvalue::hd50af93dcb00cb6fPtA
  11:        0x10b7c30e8 - trans::base::init_local::h53c6350bcde5d4f8zVg
  12:        0x10b7d3a93 - trans::controlflow::trans_block::h05c053a1e1c911e0pXu
  13:        0x10b88079c - trans::expr::trans_rvalue_dps_unadjusted::h0d3d525097831c6c9ZA
  14:        0x10b8539f7 - trans::expr::trans_into::haf8ca3e6278522acu1z
  15:        0x10b8c07f1 - trans::_match::trans_match_inner::h953f25261ea34903rVH
  16:        0x10b88075c - trans::expr::trans_rvalue_dps_unadjusted::h0d3d525097831c6c9ZA
  17:        0x10b8539f7 - trans::expr::trans_into::haf8ca3e6278522acu1z
  18:        0x10b8534e1 - trans::controlflow::trans_stmt_semi::h6eafcd2a18896ae0tWu
  19:        0x10b7d3a68 - trans::controlflow::trans_block::h05c053a1e1c911e0pXu
  20:        0x10b7d2745 - trans::base::trans_closure::hb95e36728c78f255wCh
  21:        0x10b7d43de - trans::base::trans_fn::hfe46a51c23baaac8eNh
  22:        0x10b816115 - trans::monomorphize::monomorphic_fn::h41b6fefa23d7bff0QvJ
  23:        0x10b8aa0ad - trans::glue::trans_struct_drop::h95c0ab33ac82b921cHE
  24:        0x10b8a988a - trans::glue::trans_struct_drop_flag::h2f9049e44accca59yzE
  25:        0x10b8a779c - trans::glue::get_drop_glue::h5bbbd65896407d4eOrE
  26:        0x10b7d6d53 - trans::glue::drop_ty::ha64a0229575a6c77ioE
  27:        0x10b820c1a - trans::cleanup::DropValue<'tcx>.Cleanup<'tcx>::trans::h11819e958a8977feiXp
  28:        0x10b7d403c - trans::cleanup::FunctionContext<'blk, 'tcx>.CleanupMethods<'blk, 'tcx>::pop_and_trans_custom_cleanup_scope::hc7f42f836e64f431k0o
  29:        0x10b8c0803 - trans::_match::trans_match_inner::h953f25261ea34903rVH
  30:        0x10b88075c - trans::expr::trans_rvalue_dps_unadjusted::h0d3d525097831c6c9ZA
  31:        0x10b8539f7 - trans::expr::trans_into::haf8ca3e6278522acu1z
  32:        0x10b8d6dd1 - trans::_match::mk_binding_alloca::h1219482591938210151
  33:        0x10b7c2ff9 - trans::base::init_local::h53c6350bcde5d4f8zVg
  34:        0x10b7d3a93 - trans::controlflow::trans_block::h05c053a1e1c911e0pXu
  35:        0x10b88079c - trans::expr::trans_rvalue_dps_unadjusted::h0d3d525097831c6c9ZA
  36:        0x10b8539f7 - trans::expr::trans_into::haf8ca3e6278522acu1z
  37:        0x10b8534e1 - trans::controlflow::trans_stmt_semi::h6eafcd2a18896ae0tWu
  38:        0x10b7d3a68 - trans::controlflow::trans_block::h05c053a1e1c911e0pXu
  39:        0x10b7d2745 - trans::base::trans_closure::hb95e36728c78f255wCh
  40:        0x10b7d43de - trans::base::trans_fn::hfe46a51c23baaac8eNh
  41:        0x10b816115 - trans::monomorphize::monomorphic_fn::h41b6fefa23d7bff0QvJ
  42:        0x10b8059b7 - trans::callee::trans_fn_ref_with_substs::h86c8e91680731ba8hzn
  43:        0x10b804452 - trans::callee::trans_fn_ref::h958664b74b95968fmnn
  44:        0x10b81a63b - trans::meth::trans_method_callee::h987afa832ddedd00RsI
  45:        0x10b8189cc - trans::callee::trans_call_inner::h4319642190639167236
  46:        0x10b881399 - trans::expr::trans_rvalue_dps_unadjusted::h0d3d525097831c6c9ZA
  47:        0x10b8539f7 - trans::expr::trans_into::haf8ca3e6278522acu1z
  48:        0x10b7d3da9 - trans::controlflow::trans_block::h05c053a1e1c911e0pXu
  49:        0x10b7d2745 - trans::base::trans_closure::hb95e36728c78f255wCh
  50:        0x10b7d43de - trans::base::trans_fn::hfe46a51c23baaac8eNh
  51:        0x10b816115 - trans::monomorphize::monomorphic_fn::h41b6fefa23d7bff0QvJ
  52:        0x10b8059b7 - trans::callee::trans_fn_ref_with_substs::h86c8e91680731ba8hzn
  53:        0x10b804452 - trans::callee::trans_fn_ref::h958664b74b95968fmnn
  54:        0x10b81a63b - trans::meth::trans_method_callee::h987afa832ddedd00RsI
  55:        0x10b8189cc - trans::callee::trans_call_inner::h4319642190639167236
  56:        0x10b881399 - trans::expr::trans_rvalue_dps_unadjusted::h0d3d525097831c6c9ZA
  57:        0x10b87f644 - trans::expr::trans_unadjusted::hb4afd18239032dc7GuA
  58:        0x10b7b227f - trans::expr::trans::hd8cdbc15463fe10aN7z
  59:        0x10b85356a - trans::expr::trans_to_lvalue::hd50af93dcb00cb6fPtA
  60:        0x10b7c30e8 - trans::base::init_local::h53c6350bcde5d4f8zVg
  61:        0x10b7d3a93 - trans::controlflow::trans_block::h05c053a1e1c911e0pXu
  62:        0x10b88079c - trans::expr::trans_rvalue_dps_unadjusted::h0d3d525097831c6c9ZA
  63:        0x10b8539f7 - trans::expr::trans_into::haf8ca3e6278522acu1z
  64:        0x10b7d3da9 - trans::controlflow::trans_block::h05c053a1e1c911e0pXu
  65:        0x10b7d2745 - trans::base::trans_closure::hb95e36728c78f255wCh
  66:        0x10b7d43de - trans::base::trans_fn::hfe46a51c23baaac8eNh
  67:        0x10b7d7948 - trans::base::trans_item::h5ed811cd725f9768qbi
  68:        0x10b7e6730 - trans::base::trans_crate::ha94fa9dd82b4aff2r0i
  69:        0x10b272e0e - driver::phase_4_translate_to_llvm::h1f657f4f3b9a6259hOa
  70:        0x10b24b2f4 - driver::compile_input::h00eb3ba6a5bfe392Qba
  71:        0x10b3128f3 - run_compiler::h4caa8708186861beF4b
  72:        0x10b31041a - boxed::F.FnBox<A>::call_box::h5773103399936443887
  73:        0x10b30f8b7 - rt::unwind::try::try_fn::h10299548411236091824
  74:        0x10eba32f8 - rust_try_inner
  75:        0x10eba32e5 - rust_try
  76:        0x10b30fb90 - boxed::F.FnBox<A>::call_box::h3149649929762739958
  77:        0x10eb1907d - sys::thread::create::thread_start::h2951ccda778a4dacgVv
  78:     0x7fff9b248267 - _pthread_body
  79:     0x7fff9b2481e4 - _pthread_start
@steveklabnik steveklabnik added the I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ label Apr 22, 2015
@nwin
Copy link
Contributor Author

nwin commented Apr 24, 2015

I was able to trace down the bug. It is due to me using a unicode character in the documentation of a function this somehow triggers the compiler bug. A minimal example is:

src/main.rs

extern crate lzw;

fn main() {
    let mut v = vec![];
    let _ = lzw::Encoder::new(lzw::LsbWriter::new(&mut v), 8);
}

Cargo.toml

[package]
name = "rustbug"
version = "0.1.0"

[dependencies]
lzw = "0.4.0"

@larsbergstrom
Copy link
Contributor

@brson @SimonSapin I believe Servo is also currently hitting this in the script crate during our current rust upgrade.

@SimonSapin
Copy link
Contributor

Yes, at least the failing assertion is the same. Removing non-ASCII characters from doc comments didn’t seem to help, though.

@Manishearth
Copy link
Member

cc @pnkfelix

might this be another overflow error?

@SimonSapin
Copy link
Contributor

@Aatch recommended on IRC to build with RUST_LOG=syntax::codemap, but log output seems to be disabled in Nightly. So I built Rust with debugging enabled and tried again. (This took forever because of #24840.) There was a lot of output, here is just the end of it:

DEBUG:syntax::codemap: byte pos BytePos(16658606) is on the line at byte pos BytePos(16658559)
DEBUG:syntax::codemap: char pos CharPos(51454) is on the line at char pos CharPos(51407)
DEBUG:syntax::codemap: byte is on line: 1251
DEBUG:syntax::codemap: 2-byte char at BytePos(16638556)
DEBUG:syntax::codemap: 2-byte char at BytePos(16639495)
DEBUG:syntax::codemap: 2-byte char at BytePos(16647639)
DEBUG:syntax::codemap: 2-byte char at BytePos(16654088)
DEBUG:syntax::codemap: 2-byte char at BytePos(16654573)
DEBUG:syntax::codemap: 2-byte char at BytePos(16655087)
DEBUG:syntax::codemap: 2-byte char at BytePos(16655535)
DEBUG:syntax::codemap: 2-byte char at BytePos(16655993)
DEBUG:syntax::codemap: 2-byte char at BytePos(16656585)
DEBUG:syntax::codemap: 2-byte char at BytePos(16657212)
DEBUG:syntax::codemap: 2-byte char at BytePos(16657579)
DEBUG:syntax::codemap: 2-byte char at BytePos(16658114)
DEBUG:syntax::codemap: 2-byte char at BytePos(16658626)
DEBUG:syntax::codemap: 2-byte char at BytePos(16638556)
DEBUG:syntax::codemap: 2-byte char at BytePos(16639495)
DEBUG:syntax::codemap: 2-byte char at BytePos(16647639)
DEBUG:syntax::codemap: 2-byte char at BytePos(16654088)
DEBUG:syntax::codemap: 2-byte char at BytePos(16654573)
DEBUG:syntax::codemap: 2-byte char at BytePos(16655087)
DEBUG:syntax::codemap: 2-byte char at BytePos(16655535)
DEBUG:syntax::codemap: 2-byte char at BytePos(16655993)
DEBUG:syntax::codemap: 2-byte char at BytePos(16656585)
DEBUG:syntax::codemap: 2-byte char at BytePos(16657212)
DEBUG:syntax::codemap: 2-byte char at BytePos(16657579)
DEBUG:syntax::codemap: 2-byte char at BytePos(16658114)
DEBUG:syntax::codemap: 2-byte char at BytePos(16658626)
DEBUG:syntax::codemap: byte pos BytePos(16658606) is on the line at byte pos BytePos(16658559)
DEBUG:syntax::codemap: char pos CharPos(51454) is on the line at char pos CharPos(51407)
DEBUG:syntax::codemap: byte is on line: 1251
DEBUG:syntax::codemap: 2-byte char at BytePos(16638556)
DEBUG:syntax::codemap: 2-byte char at BytePos(16639495)
DEBUG:syntax::codemap: 2-byte char at BytePos(16647639)
DEBUG:syntax::codemap: 2-byte char at BytePos(16654088)
DEBUG:syntax::codemap: 2-byte char at BytePos(16654573)
DEBUG:syntax::codemap: 2-byte char at BytePos(16655087)
DEBUG:syntax::codemap: 2-byte char at BytePos(16655535)
DEBUG:syntax::codemap: 2-byte char at BytePos(16655993)
DEBUG:syntax::codemap: 2-byte char at BytePos(16656585)
DEBUG:syntax::codemap: 2-byte char at BytePos(16657212)
DEBUG:syntax::codemap: 2-byte char at BytePos(16657579)
DEBUG:syntax::codemap: 2-byte char at BytePos(16658114)
DEBUG:syntax::codemap: 2-byte char at BytePos(16658626)
DEBUG:syntax::codemap: 2-byte char at BytePos(16638556)
DEBUG:syntax::codemap: 2-byte char at BytePos(16639495)
DEBUG:syntax::codemap: 2-byte char at BytePos(16647639)
DEBUG:syntax::codemap: 2-byte char at BytePos(16654088)
DEBUG:syntax::codemap: 2-byte char at BytePos(16654573)
DEBUG:syntax::codemap: 2-byte char at BytePos(16655087)
DEBUG:syntax::codemap: 2-byte char at BytePos(16655535)
DEBUG:syntax::codemap: 2-byte char at BytePos(16655993)
DEBUG:syntax::codemap: 2-byte char at BytePos(16656585)
DEBUG:syntax::codemap: 2-byte char at BytePos(16657212)
DEBUG:syntax::codemap: 2-byte char at BytePos(16657579)
DEBUG:syntax::codemap: 2-byte char at BytePos(16658114)
DEBUG:syntax::codemap: 2-byte char at BytePos(16658626)
DEBUG:syntax::codemap: byte pos BytePos(16658574) is on the line at byte pos BytePos(16658559)
DEBUG:syntax::codemap: char pos CharPos(51422) is on the line at char pos CharPos(51407)
DEBUG:syntax::codemap: byte is on line: 1251
DEBUG:syntax::codemap: 2-byte char at BytePos(16638556)
DEBUG:syntax::codemap: 2-byte char at BytePos(16639495)
DEBUG:syntax::codemap: 2-byte char at BytePos(16647639)
DEBUG:syntax::codemap: 2-byte char at BytePos(16654088)
DEBUG:syntax::codemap: 2-byte char at BytePos(16654573)
DEBUG:syntax::codemap: 2-byte char at BytePos(16655087)
DEBUG:syntax::codemap: 2-byte char at BytePos(16655535)
DEBUG:syntax::codemap: 2-byte char at BytePos(16655993)
DEBUG:syntax::codemap: 2-byte char at BytePos(16656585)
DEBUG:syntax::codemap: 2-byte char at BytePos(16657212)
DEBUG:syntax::codemap: 2-byte char at BytePos(16657579)
DEBUG:syntax::codemap: 2-byte char at BytePos(16658114)
DEBUG:syntax::codemap: 2-byte char at BytePos(16658626)
DEBUG:syntax::codemap: 2-byte char at BytePos(16638556)
DEBUG:syntax::codemap: 2-byte char at BytePos(16639495)
DEBUG:syntax::codemap: 2-byte char at BytePos(16647639)
DEBUG:syntax::codemap: 2-byte char at BytePos(16654088)
DEBUG:syntax::codemap: 2-byte char at BytePos(16654573)
DEBUG:syntax::codemap: 2-byte char at BytePos(16655087)
DEBUG:syntax::codemap: 2-byte char at BytePos(16655535)
DEBUG:syntax::codemap: 2-byte char at BytePos(16655993)
DEBUG:syntax::codemap: 2-byte char at BytePos(16656585)
DEBUG:syntax::codemap: 2-byte char at BytePos(16657212)
DEBUG:syntax::codemap: 2-byte char at BytePos(16657579)
DEBUG:syntax::codemap: 2-byte char at BytePos(16658114)
DEBUG:syntax::codemap: 2-byte char at BytePos(16658626)
DEBUG:syntax::codemap: byte pos BytePos(16658574) is on the line at byte pos BytePos(16658559)
DEBUG:syntax::codemap: char pos CharPos(51422) is on the line at char pos CharPos(51407)
DEBUG:syntax::codemap: byte is on line: 1251
DEBUG:syntax::codemap: byte pos BytePos(13039630) is on the line at byte pos BytePos(13039587)
DEBUG:syntax::codemap: char pos CharPos(654) is on the line at char pos CharPos(611)
DEBUG:syntax::codemap: byte is on line: 11
DEBUG:syntax::codemap: byte pos BytePos(13039630) is on the line at byte pos BytePos(13039587)
DEBUG:syntax::codemap: char pos CharPos(654) is on the line at char pos CharPos(611)
DEBUG:syntax::codemap: byte is on line: 11
DEBUG:syntax::codemap: 2-byte char at BytePos(16638556)
DEBUG:syntax::codemap: 2-byte char at BytePos(16639495)
DEBUG:syntax::codemap: 2-byte char at BytePos(16647639)
DEBUG:syntax::codemap: 2-byte char at BytePos(16654088)
DEBUG:syntax::codemap: 2-byte char at BytePos(16654573)
DEBUG:syntax::codemap: 2-byte char at BytePos(16655087)
DEBUG:syntax::codemap: 2-byte char at BytePos(16655535)
DEBUG:syntax::codemap: 2-byte char at BytePos(16655993)
DEBUG:syntax::codemap: 2-byte char at BytePos(16656585)
DEBUG:syntax::codemap: 2-byte char at BytePos(16657212)
DEBUG:syntax::codemap: 2-byte char at BytePos(16657579)
DEBUG:syntax::codemap: 2-byte char at BytePos(16658114)
DEBUG:syntax::codemap: 2-byte char at BytePos(16658626)
DEBUG:syntax::codemap: 2-byte char at BytePos(16638556)
DEBUG:syntax::codemap: 2-byte char at BytePos(16639495)
DEBUG:syntax::codemap: 2-byte char at BytePos(16647639)
DEBUG:syntax::codemap: 2-byte char at BytePos(16654088)
DEBUG:syntax::codemap: 2-byte char at BytePos(16654573)
DEBUG:syntax::codemap: 2-byte char at BytePos(16655087)
DEBUG:syntax::codemap: 2-byte char at BytePos(16655535)
DEBUG:syntax::codemap: 2-byte char at BytePos(16655993)
DEBUG:syntax::codemap: 2-byte char at BytePos(16656585)
DEBUG:syntax::codemap: 2-byte char at BytePos(16657212)
DEBUG:syntax::codemap: 2-byte char at BytePos(16657579)
DEBUG:syntax::codemap: 2-byte char at BytePos(16658114)
DEBUG:syntax::codemap: 2-byte char at BytePos(16658626)
DEBUG:syntax::codemap: byte pos BytePos(16658606) is on the line at byte pos BytePos(16658559)
DEBUG:syntax::codemap: char pos CharPos(51454) is on the line at char pos CharPos(51407)
DEBUG:syntax::codemap: byte is on line: 1251
DEBUG:syntax::codemap: byte pos BytePos(13039630) is on the line at byte pos BytePos(13039587)
DEBUG:syntax::codemap: char pos CharPos(654) is on the line at char pos CharPos(611)
DEBUG:syntax::codemap: byte is on line: 11
DEBUG:syntax::codemap: 2-byte char at BytePos(16638556)
DEBUG:syntax::codemap: 2-byte char at BytePos(16639495)
DEBUG:syntax::codemap: 2-byte char at BytePos(16647639)
DEBUG:syntax::codemap: 2-byte char at BytePos(16654088)
DEBUG:syntax::codemap: 2-byte char at BytePos(16654573)
DEBUG:syntax::codemap: 2-byte char at BytePos(16655087)
DEBUG:syntax::codemap: 2-byte char at BytePos(16655535)
DEBUG:syntax::codemap: 2-byte char at BytePos(16655993)
DEBUG:syntax::codemap: 2-byte char at BytePos(16656585)
DEBUG:syntax::codemap: 2-byte char at BytePos(16657212)
DEBUG:syntax::codemap: 2-byte char at BytePos(16657579)
DEBUG:syntax::codemap: 2-byte char at BytePos(16658114)
DEBUG:syntax::codemap: 2-byte char at BytePos(16658626)
DEBUG:syntax::codemap: 2-byte char at BytePos(16638556)
DEBUG:syntax::codemap: 2-byte char at BytePos(16639495)
DEBUG:syntax::codemap: 2-byte char at BytePos(16647639)
DEBUG:syntax::codemap: 2-byte char at BytePos(16654088)
DEBUG:syntax::codemap: 2-byte char at BytePos(16654573)
DEBUG:syntax::codemap: 2-byte char at BytePos(16655087)
DEBUG:syntax::codemap: 2-byte char at BytePos(16655535)
DEBUG:syntax::codemap: 2-byte char at BytePos(16655993)
DEBUG:syntax::codemap: 2-byte char at BytePos(16656585)
DEBUG:syntax::codemap: 2-byte char at BytePos(16657212)
DEBUG:syntax::codemap: 2-byte char at BytePos(16657579)
DEBUG:syntax::codemap: 2-byte char at BytePos(16658114)
DEBUG:syntax::codemap: 2-byte char at BytePos(16658626)
DEBUG:syntax::codemap: byte pos BytePos(16658574) is on the line at byte pos BytePos(16658559)
DEBUG:syntax::codemap: char pos CharPos(51422) is on the line at char pos CharPos(51407)
DEBUG:syntax::codemap: byte is on line: 1251
DEBUG:syntax::codemap: 2-byte char at BytePos(16638556)
DEBUG:syntax::codemap: 2-byte char at BytePos(16639495)
DEBUG:syntax::codemap: 2-byte char at BytePos(16647639)
DEBUG:syntax::codemap: 2-byte char at BytePos(16654088)
DEBUG:syntax::codemap: 2-byte char at BytePos(16654573)
DEBUG:syntax::codemap: 2-byte char at BytePos(16655087)
DEBUG:syntax::codemap: 2-byte char at BytePos(16655535)
DEBUG:syntax::codemap: 2-byte char at BytePos(16655993)
DEBUG:syntax::codemap: 2-byte char at BytePos(16656585)
DEBUG:syntax::codemap: 2-byte char at BytePos(16657212)
DEBUG:syntax::codemap: 2-byte char at BytePos(16657579)
DEBUG:syntax::codemap: 2-byte char at BytePos(16658114)
DEBUG:syntax::codemap: 2-byte char at BytePos(16658626)
DEBUG:syntax::codemap: 2-byte char at BytePos(16638556)
DEBUG:syntax::codemap: 2-byte char at BytePos(16639495)
DEBUG:syntax::codemap: 2-byte char at BytePos(16647639)
DEBUG:syntax::codemap: 2-byte char at BytePos(16654088)
DEBUG:syntax::codemap: 2-byte char at BytePos(16654573)
DEBUG:syntax::codemap: 2-byte char at BytePos(16655087)
DEBUG:syntax::codemap: 2-byte char at BytePos(16655535)
DEBUG:syntax::codemap: 2-byte char at BytePos(16655993)
DEBUG:syntax::codemap: 2-byte char at BytePos(16656585)
DEBUG:syntax::codemap: 2-byte char at BytePos(16657212)
DEBUG:syntax::codemap: 2-byte char at BytePos(16657579)
DEBUG:syntax::codemap: 2-byte char at BytePos(16658114)
DEBUG:syntax::codemap: 2-byte char at BytePos(16658626)
DEBUG:syntax::codemap: byte pos BytePos(16658574) is on the line at byte pos BytePos(16658559)
DEBUG:syntax::codemap: char pos CharPos(51422) is on the line at char pos CharPos(51407)
DEBUG:syntax::codemap: byte is on line: 1251
DEBUG:syntax::codemap: byte pos BytePos(13039630) is on the line at byte pos BytePos(13039587)
DEBUG:syntax::codemap: char pos CharPos(654) is on the line at char pos CharPos(611)
DEBUG:syntax::codemap: byte is on line: 11
DEBUG:syntax::codemap: byte pos BytePos(13039630) is on the line at byte pos BytePos(13039587)
DEBUG:syntax::codemap: char pos CharPos(654) is on the line at char pos CharPos(611)
DEBUG:syntax::codemap: byte is on line: 11
DEBUG:syntax::codemap: byte pos BytePos(13039630) is on the line at byte pos BytePos(13039587)
DEBUG:syntax::codemap: char pos CharPos(654) is on the line at char pos CharPos(611)
DEBUG:syntax::codemap: byte is on line: 11
DEBUG:syntax::codemap: byte pos BytePos(13039587) is on the line at byte pos BytePos(13039587)
DEBUG:syntax::codemap: char pos CharPos(611) is on the line at char pos CharPos(611)
DEBUG:syntax::codemap: byte is on line: 11
DEBUG:syntax::codemap: byte pos BytePos(13039587) is on the line at byte pos BytePos(13039587)
DEBUG:syntax::codemap: char pos CharPos(611) is on the line at char pos CharPos(611)
DEBUG:syntax::codemap: byte is on line: 11
DEBUG:syntax::codemap: byte pos BytePos(13039587) is on the line at byte pos BytePos(13039587)
DEBUG:syntax::codemap: char pos CharPos(611) is on the line at char pos CharPos(611)
DEBUG:syntax::codemap: byte is on line: 11
DEBUG:syntax::codemap: byte pos BytePos(13039585) is on the line at byte pos BytePos(13039556)
DEBUG:syntax::codemap: char pos CharPos(609) is on the line at char pos CharPos(580)
DEBUG:syntax::codemap: byte is on line: 10
DEBUG:syntax::codemap: byte pos BytePos(13039585) is on the line at byte pos BytePos(13039556)
DEBUG:syntax::codemap: char pos CharPos(609) is on the line at char pos CharPos(580)
DEBUG:syntax::codemap: byte is on line: 10
DEBUG:syntax::codemap: byte pos BytePos(13039216) is on the line at byte pos BytePos(13039187)
DEBUG:syntax::codemap: char pos CharPos(240) is on the line at char pos CharPos(211)
DEBUG:syntax::codemap: byte is on line: 5
DEBUG:syntax::codemap: byte pos BytePos(13039046) is on the line at byte pos BytePos(13039046)
DEBUG:syntax::codemap: char pos CharPos(70) is on the line at char pos CharPos(70)
DEBUG:syntax::codemap: byte is on line: 2
DEBUG:syntax::codemap: 2-byte char at BytePos(16638556)
DEBUG:syntax::codemap: 2-byte char at BytePos(16639495)
DEBUG:syntax::codemap: 2-byte char at BytePos(16647639)
DEBUG:syntax::codemap: 2-byte char at BytePos(16654088)
DEBUG:syntax::codemap: 2-byte char at BytePos(16654573)
DEBUG:syntax::codemap: 2-byte char at BytePos(16655087)
DEBUG:syntax::codemap: 2-byte char at BytePos(16655535)
DEBUG:syntax::codemap: 2-byte char at BytePos(16655993)
DEBUG:syntax::codemap: 2-byte char at BytePos(16656585)
DEBUG:syntax::codemap: 2-byte char at BytePos(16657212)
DEBUG:syntax::codemap: 2-byte char at BytePos(16657579)
DEBUG:syntax::codemap: 2-byte char at BytePos(16658114)
DEBUG:syntax::codemap: 2-byte char at BytePos(16658626)
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: run with `RUST_BACKTRACE=1` for a backtrace
thread 'rustc' panicked at 'assertion failed: bpos.to_usize() >= mbc.pos.to_usize() + mbc.bytes', /home/simon/projects/rust/src/libsyntax/codemap.rs:777

stack backtrace:
   1:     0x7f71ce0dced0 - sys::backtrace::write::h08980a46da6e74e2BYr
   2:     0x7f71ce107b90 - panicking::on_panic::hb2484b9e4c558cd8pow
   3:     0x7f71ce03f19a - rt::unwind::begin_unwind_inner::hfc82ed5074bb350fz3v
   4:     0x7f71c99d23d5 - rt::unwind::begin_unwind::h2534745300781190008
   5:     0x7f71c9b37757 - codemap::CodeMap::bytepos_to_file_charpos::h6d1c81abe106f045uoA
   6:     0x7f71c9b31f46 - codemap::CodeMap::lookup_pos::h27d65e66f05d4f4a6wA
   7:     0x7f71c9b31bc6 - codemap::CodeMap::lookup_char_pos::h02661bc11144a6711eA
   8:     0x7f71cc6f4c26 - trans::debuginfo::span_start::h9bf55337ae693b740Ey
   9:     0x7f71cc6fddd6 - trans::debuginfo::set_source_location::hbf96c03b4e6ff4fbyUw
  10:     0x7f71cc6d1164 - trans::expr::trans_into::h5a3dbd1afd743e21Z3z
  11:     0x7f71cc508d12 - trans::controlflow::trans_block::h6871c127495454c2n1u
  12:     0x7f71cc505604 - trans::base::trans_closure::hea4a26a7f91465e2WDh
  13:     0x7f71cc5097b1 - trans::base::trans_fn::hbb78e9676a50cfaeEOh
  14:     0x7f71cc6034fa - trans::monomorphize::monomorphic_fn::h80a7be131545d682YzJ
  15:     0x7f71cc5e4655 - trans::callee::trans_fn_ref_with_substs::hb1478d6051ffa327hGn
  16:     0x7f71cc5e0d1c - trans::callee::trans_fn_ref::h93734b12782ed2ffmun
  17:     0x7f71cc60c65f - trans::meth::trans_method_callee::h5fff77d6ceae5c3dZwI
  18:     0x7f71cc60b569 - trans::callee::trans_method_call::closure.46850
  19:     0x7f71cc60940b - trans::callee::trans_call_inner::h17766741276310928787
  20:     0x7f71cc6090e4 - trans::callee::trans_method_call::hed20f80cc0b413f7cWn
  21:     0x7f71cc7527e8 - trans::expr::trans_rvalue_dps_unadjusted::h83be1216c408f410E2A
  22:     0x7f71cc74fdbe - trans::expr::trans_unadjusted::haf468703d9fe6a89bxA
  23:     0x7f71cc4a10ce - trans::expr::trans::had454b703659cbaaiaA
  24:     0x7f71cc6d391d - trans::controlflow::trans_while::hd34ba84a34a1f8e40bv
  25:     0x7f71cc75408a - trans::expr::trans_rvalue_stmt_unadjusted::hb225337bc26f736aTWA
  26:     0x7f71cc6d1f5c - trans::expr::trans_into::h5a3dbd1afd743e21Z3z
  27:     0x7f71cc6d0cab - trans::controlflow::trans_stmt_semi::hce795bf5cb8c3dacr0u
  28:     0x7f71cc6d0901 - trans::controlflow::trans_stmt::he906ac264fddc322IWu
  29:     0x7f71cc50895f - trans::controlflow::trans_block::h6871c127495454c2n1u
  30:     0x7f71cc505604 - trans::base::trans_closure::hea4a26a7f91465e2WDh
  31:     0x7f71cc5097b1 - trans::base::trans_fn::hbb78e9676a50cfaeEOh
  32:     0x7f71cc6034fa - trans::monomorphize::monomorphic_fn::h80a7be131545d682YzJ
  33:     0x7f71cc5e4655 - trans::callee::trans_fn_ref_with_substs::hb1478d6051ffa327hGn
  34:     0x7f71cc5e0d1c - trans::callee::trans_fn_ref::h93734b12782ed2ffmun
  35:     0x7f71cc60c65f - trans::meth::trans_method_callee::h5fff77d6ceae5c3dZwI
  36:     0x7f71cc60b569 - trans::callee::trans_method_call::closure.46850
  37:     0x7f71cc60940b - trans::callee::trans_call_inner::h17766741276310928787
  38:     0x7f71cc6090e4 - trans::callee::trans_method_call::hed20f80cc0b413f7cWn
  39:     0x7f71cc7527e8 - trans::expr::trans_rvalue_dps_unadjusted::h83be1216c408f410E2A
  40:     0x7f71cc6d1f1d - trans::expr::trans_into::h5a3dbd1afd743e21Z3z
  41:     0x7f71cc6d0cab - trans::controlflow::trans_stmt_semi::hce795bf5cb8c3dacr0u
  42:     0x7f71cc6d0901 - trans::controlflow::trans_stmt::he906ac264fddc322IWu
  43:     0x7f71cc50895f - trans::controlflow::trans_block::h6871c127495454c2n1u
  44:     0x7f71cc505604 - trans::base::trans_closure::hea4a26a7f91465e2WDh
  45:     0x7f71cc5097b1 - trans::base::trans_fn::hbb78e9676a50cfaeEOh
  46:     0x7f71cc524095 - trans::meth::trans_impl::h87001477d5bcaf621rI
  47:     0x7f71cc517bfe - trans::base::trans_item::h9f1576297a068a24Qci
  48:     0x7f71cc524385 - trans::base::trans_mod::h417fe1d01d08c6aarji
  49:     0x7f71cc517c1a - trans::base::trans_item::h9f1576297a068a24Qci
  50:     0x7f71cc524385 - trans::base::trans_mod::h417fe1d01d08c6aarji
  51:     0x7f71cc517c1a - trans::base::trans_item::h9f1576297a068a24Qci
  52:     0x7f71cc524385 - trans::base::trans_mod::h417fe1d01d08c6aarji
  53:     0x7f71cc541fe6 - trans::base::trans_crate::hbfdd1c436c9d28cfQ1i
  54:     0x7f71ce948bb6 - driver::phase_4_translate_to_llvm::closure.21711
  55:     0x7f71ce948495 - util::common::time::h2155069861539402289
  56:     0x7f71ce79f8f8 - driver::phase_4_translate_to_llvm::h88ba570da300781anOa
  57:     0x7f71ce727095 - driver::compile_input::h1510f854f2d36ee2Qba
  58:     0x7f71ce9c0a6c - run_compiler::h95c097e7c3641e22F4b
  59:     0x7f71ce9bd18f - run::closure.24225
  60:     0x7f71ce9bc315 - monitor::closure.24198
  61:     0x7f71ce9bc1d1 - boxed::F.FnBox<A>::call_box::h12119986062606539287
  62:     0x7f71ce9bbd89 - boxed::Box<FnBox<A, Output $u3d$$u20$R$GT$$u2b$$u20$Send$u20$$u2b$$u20$$u27$a$GT$.FnOnce$LT$A$GT$::call_once::h5437889980002254030
  63:     0x7f71ce9bb47f - thread::Builder::spawn_inner::closure.24176
  64:     0x7f71ce9bb410 - rt::unwind::try::try_fn::__rust_abi::h16853098609345213920
  65:     0x7f71ce9bb3a2 - rt::unwind::try::try_fn::h16853098609345213920
  66:     0x7f71ce23db38 - rust_try_inner
  67:     0x7f71ce23db25 - rust_try
  68:     0x7f71ce9ba87d - rt::unwind::try::h2566811498102976929
  69:     0x7f71ce9ba63f - thread::Builder::spawn_inner::closure.24111
  70:     0x7f71ce9bc00e - boxed::F.FnBox<A>::call_box::h5616702962572060708
  71:     0x7f71ce0d41c9 - boxed::Box<FnBox<A, Output $u3d$$u20$R$GT$$u2b$$u20$$u27$a$GT$.FnOnce$LT$A$GT$::call_once::h9226137156718365614
  72:     0x7f71ce0d40c1 - sys_common::thread::start_thread::hbce903f8d63cd24fm0q
  73:     0x7f71ce10354d - sys::thread::Thread::new::thread_start::__rust_abi
  74:     0x7f71ce10353d - sys::thread::Thread::new::thread_start::h9f22503d649858f609u
  75:     0x7f71c67be373 - start_thread
  76:     0x7f71cdcb227c - clone
  77:                0x0 - <unknown>

Could not compile `script`.

To learn more, run the command again with --verbose.
Build completed in 3326.77s

Total: 55:27.80)       User: 52:50.22)       Kernel: 1:31.78)       System: 98%)

@SimonSapin
Copy link
Contributor

This is 4013523 lines / 299MB of output.

@pnkfelix
Copy link
Member

my current hypothesis is that this addition in creader.rs is the problem; it is at the very least very suspicious considering that five lines up in the previous statement we are normalizing the position to zero by subtracting the start_pos, not adding it.

@pnkfelix
Copy link
Member

(other good news: I have figured out how to make a regression test for this that will integrate into the rust test suite.)

SimonSapin added a commit to servo/servo that referenced this issue Apr 29, 2015
pnkfelix added a commit to pnkfelix/rust that referenced this issue Apr 29, 2015
bors added a commit that referenced this issue Apr 29, 2015
metdata: Fix zero-normalization of the pos of a `MultiByteChar`

Fix #24687

The source byte/character mappings for every crate track the collection of multi-characters from its source files specially.  When we import the source information for another file into the current compilation unit, we assign its byte-positions unique values by shifting them all by a fixed adjustment, tracked in the `start_pos` field.  But when we pull out the source span information for one function from one crate and into our own crate, we need to re-normalize the byte positions: subtracting the old `start_pos` and adding the new `start_pos`. The `new_imported_filemap(..)` method handles adding the new `start_pos`, so all `creader` needs to do is re-normalize each `pos` to zero.

It seems like it was indeed trying to do this, but it mistakenly added the old `start_pos` instead of subtracting it.
alexcrichton pushed a commit to alexcrichton/rust that referenced this issue Apr 30, 2015
SimonSapin added a commit to servo/servo that referenced this issue May 1, 2015
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

Successfully merging a pull request may close this issue.

6 participants