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

rustc panics with index out of bounds #28343

Closed
jethington opened this issue Sep 11, 2015 · 4 comments
Closed

rustc panics with index out of bounds #28343

jethington opened this issue Sep 11, 2015 · 4 comments
Labels
I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️

Comments

@jethington
Copy link

Sample code in question:

struct MyStruct {
  x: i32,
}

fn foo(v: &Vec<i32>, s: &MyStruct) {

}

fn main() {
  let v1 = vec![];
  let v2 = vec![];

  foo(&v1, &v2);
}

rustc correctly complains about the type of the second argument in the call to foo(), but then panics.

Backtrace:

thread 'rustc' panicked at 'index out of bounds: the len is 16 but the index is 18', ../src/libcollections\vec.rs:1362

stack backtrace:
   1:         0x66139105 - sys::backtrace::write::h2345dffb6069c92cLAs
   2:         0x661428ac - rt::unwind::register::heb8429a612e0fecdqfw
   3:         0x6610561f - rt::unwind::begin_unwind_inner::h3f101c489f219c5fzcw
   4:         0x66105f9a - rt::unwind::begin_unwind_fmt::he6ac4cfedf51005fFbw
   5:         0x661422c3 - rust_begin_unwind
   6:         0x6615ecd9 - panicking::panic_fmt::h99704e91012c930eH8B
   7:         0x6615a26c - panicking::panic_bounds_check::h8d3de3daf2e596c2N7B
   8:         0x65a5e907 - middle::infer::freshen::TypeFreshener<'a, 'tcx>.TypeFolder<'tcx>::fold_ty::hbca5c887c3745f43b5z
   9:         0x65a5fb4b - middle::infer::unify_key::ast..FloatTy.ToType<'tcx>::to_type::hb65f703f4a4fad8c7FA
  10:         0x659d3791 - middle::traits::select::SelectionContext<'cx, 'tcx>::select::hb3b2b18dad173700hkT
  11:         0x65aca7a7 - middle::traits::fulfill::FulfillmentContext<'tcx>::select_new_obligations::h12b24e6749072c24d8Q
  12:         0x65ac969c - middle::traits::fulfill::FulfillmentContext<'tcx>::select_where_possible::haaf097f39f0be13fM8Q
  13:           0x54d8aa - check::check_intrinsic_type::h3e6dfe9da166ee14yEt
  14:           0x5407aa - check::check_item_types::hd1042841d741e347tKn
  15:           0x53e7b6 - check::check_item_body::hc6836ce7ef602161ydo
  16:           0x540404 - check::check_item_types::hd1042841d741e347tKn
  17:           0x5f9752 - check_crate::h93d1a9d819c9d1819fD
  18:         0x6efa8ac9 - driver::assign_node_ids_and_map::h05e579775eaf79194Da
  19:         0x6efa6f14 - driver::assign_node_ids_and_map::h05e579775eaf79194Da
  20:         0x6efa1409 - driver::assign_node_ids_and_map::h05e579775eaf79194Da
  21:         0x6ef82a66 - driver::compile_input::hd2fb89b180675596Tba
  22:         0x6f06460d - run_compiler::h282bf3c3999ca505x7b
  23:         0x6f062295 - run::h1c01070ec49f4ed0d7b
  24:         0x6f061bd9 - run::h1c01070ec49f4ed0d7b
  25:         0x6617d82c - rust_try
  26:         0x6617d809 - rust_try
  27:         0x6612d4d5 - rt::unwind::try::inner_try::h75b7bddb15a6c10cs8v
  28:         0x6f061d97 - run::h1c01070ec49f4ed0d7b
  29:         0x66140404 - sys::process::Command::cwd::heb9c93936e48371awUu
  30:     0x7ffb846b13d2 - BaseThreadInitThunk

Version:

rustc 1.2.0 (082e47636 2015-08-03)
binary: rustc
commit-hash: 082e4763615bdbe7b4dd3dfd6fc2210b7773edf5
commit-date: 2015-08-03
host: x86_64-pc-windows-gnu
release: 1.2.0
@jdm jdm added the I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ label Sep 11, 2015
@bluss
Copy link
Member

bluss commented Sep 11, 2015

Also occurs on current nightly.

@apasel422
Copy link
Contributor

Reduced:

fn foo(v: &i32) {}

fn main() {
    foo(&Vec::new());
}

@apasel422
Copy link
Contributor

Also happens with &f32. The index into the unification table passed to probe is out of bounds.

@arielb1
Copy link
Contributor

arielb1 commented Sep 26, 2015

duplicate of #24819

@arielb1 arielb1 closed this as completed Sep 26, 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

No branches or pull requests

5 participants