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 with mir-opt-level=2: Got a wide pointer where a scalar was expected #67710

Closed
bytwise opened this issue Dec 29, 2019 · 2 comments · Fixed by #67796
Closed

ICE with mir-opt-level=2: Got a wide pointer where a scalar was expected #67710

bytwise opened this issue Dec 29, 2019 · 2 comments · Fixed by #67796
Labels
A-const-eval Area: constant evaluation (mir interpretation) C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ requires-nightly This issue requires a nightly compiler in some way. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@bytwise
Copy link
Contributor

bytwise commented Dec 29, 2019

pub fn parse(version: ()) {
    p(&b'.', b"0");
}
#[inline(always)]
fn p(byte: &u8, s: &[u8]) {
    !(s[0] == *byte);
}

Compiler output

error: internal compiler error: src/librustc_mir/interpret/operand.rs:69: Got a wide pointer where a scalar was expected

thread 'rustc' panicked at 'Box<Any>', src/librustc_errors/lib.rs:891:9
stack backtrace:
   0: <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt
   1: core::fmt::write
   2: std::io::Write::write_fmt
   3: std::panicking::default_hook::{{closure}}
   4: std::panicking::default_hook
   5: rustc_driver::report_ice
   6: std::panicking::rust_panic_with_hook
   7: std::panicking::begin_panic
   8: rustc_errors::HandlerInner::bug
   9: rustc_errors::Handler::bug
  10: rustc::util::bug::opt_span_bug_fmt::{{closure}}
  11: rustc::ty::context::tls::with_opt::{{closure}}
  12: rustc::ty::context::tls::with_opt
  13: rustc::util::bug::opt_span_bug_fmt
  14: rustc::util::bug::bug_fmt
  15: rustc_mir::interpret::operand::<impl rustc_mir::interpret::eval_context::InterpCx<M>>::read_scalar
  16: rustc_mir::interpret::place::<impl rustc_mir::interpret::eval_context::InterpCx<M>>::mplace_projection
  17: rustc_mir::interpret::operand::<impl rustc_mir::interpret::eval_context::InterpCx<M>>::eval_place_to_op
  18: rustc_mir::interpret::operand::<impl rustc_mir::interpret::eval_context::InterpCx<M>>::eval_operand
  19: rustc_mir::interpret::step::<impl rustc_mir::interpret::eval_context::InterpCx<M>>::eval_rvalue_into_place
  20: <rustc_mir::transform::const_prop::ConstPropagator as rustc::mir::visit::MutVisitor>::visit_statement
  21: <rustc_mir::transform::const_prop::ConstProp as rustc_mir::transform::MirPass>::run_pass
  22: rustc_mir::transform::run_passes
  23: rustc_mir::transform::run_optimization_passes
  24: rustc_mir::transform::optimized_mir
  25: rustc::ty::query::<impl rustc::ty::query::config::QueryAccessors for rustc::ty::query::queries::optimized_mir>::compute
  26: rustc::dep_graph::graph::DepGraph::with_task_impl
  27: rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt>::get_query
  28: rustc::ty::<impl rustc::ty::context::TyCtxt>::instance_mir
  29: rustc_mir::monomorphize::collector::collect_items_rec
  30: rustc_mir::monomorphize::collector::collect_crate_mono_items::{{closure}}
  31: rustc::util::common::time
  32: rustc_mir::monomorphize::collector::collect_crate_mono_items
  33: rustc::util::common::time
  34: rustc_mir::monomorphize::partitioning::collect_and_partition_mono_items
  35: rustc::ty::query::__query_compute::collect_and_partition_mono_items
  36: rustc::dep_graph::graph::DepGraph::with_task_impl
  37: rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt>::get_query
  38: rustc_codegen_ssa::back::symbol_export::exported_symbols_provider_local
  39: rustc::ty::query::__query_compute::exported_symbols
  40: rustc::dep_graph::graph::DepGraph::with_task_impl
  41: rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt>::get_query
  42: rustc_metadata::rmeta::encoder::EncodeContext::encode_crate_root
  43: rustc::ty::context::tls::with_context::{{closure}}
  44: rustc_metadata::rmeta::encoder::encode_metadata
  45: rustc_metadata::rmeta::decoder::cstore_impl::<impl rustc::middle::cstore::CrateStore for rustc_metadata::creader::CStore>::encode_metadata
  46: rustc::ty::context::TyCtxt::encode_metadata
  47: rustc_interface::passes::encode_and_write_metadata
  48: rustc::util::common::time
  49: rustc_interface::passes::start_codegen
  50: rustc::ty::context::tls::enter_global
  51: rustc_interface::queries::Queries::ongoing_codegen
  52: rustc_interface::interface::run_compiler_in_existing_thread_pool
  53: std::thread::local::LocalKey<T>::with
  54: scoped_tls::ScopedKey<T>::set
  55: syntax::with_globals
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

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.42.0-nightly (74c4e6a98 2019-12-27) running on x86_64-apple-darwin

note: compiler flags: -Z mir-opt-level=2 --crate-type lib

query stack during panic:
#0 [optimized_mir] processing `parse`
#1 [collect_and_partition_mono_items] collect_and_partition_mono_items
#2 [exported_symbols] exported_symbols
end of query stack
error: aborting due to previous error
@Centril Centril added requires-nightly This issue requires a nightly compiler in some way. A-const-eval Area: constant evaluation (mir interpretation) I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ C-bug Category: This is a bug. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Dec 29, 2019
@Centril
Copy link
Contributor

Centril commented Dec 29, 2019

cc @oli-obk @wesleywiser

@Aaron1011
Copy link
Member

Note that you need to add fn main() { parse(()) } to actually reproduce the ICE

JohnTitor added a commit to JohnTitor/rust that referenced this issue Jan 3, 2020
…sleywiser

Ensure that we process projections during MIR inlining

Fixes rust-lang#67710

Previously, we were not calling `super_place`, which resulted in us
failing to update any local references that occur in
ProjectionElem::Index. This caused the post-inlining MIR to contain a
reference to a local ID from the inlined callee, leading to an ICE
due to a type mismatch.
@bors bors closed this as completed in e8e53b5 Jan 3, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-const-eval Area: constant evaluation (mir interpretation) C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ requires-nightly This issue requires a nightly compiler in some way. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants