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

rust 1.24 the compiler unexpectedly panicked with openssl crate #48248

Closed
fafhrd91 opened this issue Feb 15, 2018 · 6 comments
Closed

rust 1.24 the compiler unexpectedly panicked with openssl crate #48248

fafhrd91 opened this issue Feb 15, 2018 · 6 comments
Labels
C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ regression-from-stable-to-stable Performance or correctness regression from one stable version to another. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@fafhrd91
Copy link

fafhrd91 commented Feb 15, 2018

error: internal compiler error: /checkout/src/librustc/ty/subst.rs:424: Region parameter out of range when substituting in region 'a (root type=Some(unsafe fn(*mut <Self as foreign_types::ForeignTypeRef>::CType) -> &'a mut Self {<Self as foreign_types::ForeignTypeRef>::from_ptr_mut::<'a>})) (index=1)
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.24.0 (4d90ac38c 2018-02-12) running on x86_64-unknown-linux-gnu

this bug is reported #46793
but now it is in stable

$ rustc --version
rustc 1.24.0 (4d90ac38c 2018-02-12)
$ rustup --version
rustup 1.11.0 (e751ff9f8 2018-02-13)
$ cargo --version
cargo 0.25.0 (8c93e0895 2018-02-01)
@sfackler
Copy link
Member

I don't see this, at least building the master branch of the rust-openssl repo.

@fafhrd91
Copy link
Author

it panics consistently for last couple months for my project (actix-web)
https://travis-ci.org/actix/actix-web/jobs/342089957

@sfackler sfackler added I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. regression-from-stable-to-stable Performance or correctness regression from one stable version to another. labels Feb 15, 2018
@pietroalbini
Copy link
Member

OK, I managed to reproduce this. The ICE only appears if the -C link-dead-code flag is passed to rustc (which is also the reason why this regression wasn't catched by crater).

pietro@january: ~/tmp/rust-openssl (master)$ RUST_BACKTRACE=1 RUSTFLAGS="-C link-dead-code" cargo +stable test
   Compiling openssl v0.10.3 (file:///home/pietro/tmp/rust-openssl/openssl)
error: internal compiler error: /checkout/src/librustc/ty/subst.rs:424: Region parameter out of range when substituting in region 'a (root type=Some(unsafe fn(*mut <Self as foreign_types::ForeignTypeRef>::CType) -> &'a mut Self {<Self as foreign_types::ForeignTyp$
Ref>::from_ptr_mut::<'a>})) (index=1)

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.24.0 (4d90ac38c 2018-02-12) running on x86_64-unknown-linux-gnu

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

thread 'rustc' panicked at 'Box<Any>', /checkout/src/librustc_errors/lib.rs:451:9
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 /checkout/src/libstd/sys/unix/backtrace/tracing/gcc_s.rs:49
   1: std::sys_common::backtrace::print
             at /checkout/src/libstd/sys_common/backtrace.rs:68
             at /checkout/src/libstd/sys_common/backtrace.rs:57
   2: std::panicking::default_hook::{{closure}}
             at /checkout/src/libstd/panicking.rs:381
   3: std::panicking::default_hook
             at /checkout/src/libstd/panicking.rs:391
   4: std::panicking::rust_panic_with_hook
             at /checkout/src/libstd/panicking.rs:577
   5: std::panicking::begin_panic
   6: rustc_errors::Handler::span_bug
   7: <std::thread::local::LocalKey<T>>::with
   8: rustc::ty::context::tls::with_opt
   9: rustc::session::opt_span_bug_fmt
  10: rustc::session::span_bug_fmt
  11: <rustc::ty::subst::SubstFolder<'a, 'gcx, 'tcx> as rustc::ty::fold::TypeFolder<'gcx, 'tcx>>::fold_region
  12: rustc::ty::fold::TypeFoldable::fold_with
  13: <rustc_data_structures::accumulate_vec::AccumulateVec<A> as core::iter::traits::FromIterator<<A as rustc_data_structures::array_vec::Array>::Element>>::from_iter
  14: rustc::ty::fold::TypeFoldable::fold_with
  15: rustc::ty::structural_impls::<impl rustc::ty::fold::TypeFoldable<'tcx> for &'tcx rustc::ty::TyS<'tcx>>::super_fold_with
  16: <rustc::ty::subst::SubstFolder<'a, 'gcx, 'tcx> as rustc::ty::fold::TypeFolder<'gcx, 'tcx>>::fold_ty
  17: rustc::traits::trans::<impl rustc::ty::context::TyCtxt<'a, 'tcx, 'tcx>>::trans_apply_param_substs
  18: rustc::ty::instance::Instance::ty
  19: rustc_trans::trans_item::predefine_fn
  20: rustc_trans::trans_item::MonoItemExt::predefine
  21: rustc_trans::base::compile_codegen_unit
  22: rustc::ty::maps::<impl rustc::ty::maps::queries::compile_codegen_unit<'tcx>>::compute_result
  23: rustc::dep_graph::graph::DepGraph::with_task_impl
  24: rustc_errors::Handler::track_diagnostics
  25: rustc::ty::maps::plumbing::<impl rustc::ty::context::TyCtxt<'a, 'gcx, 'tcx>>::cycle_check
  26: rustc::ty::maps::<impl rustc::ty::maps::queries::compile_codegen_unit<'tcx>>::force
  27: rustc::ty::maps::<impl rustc::ty::maps::queries::compile_codegen_unit<'tcx>>::try_get
  28: rustc::ty::maps::TyCtxtAt::compile_codegen_unit
  29: rustc::ty::maps::<impl rustc::ty::context::TyCtxt<'a, 'tcx, 'lcx>>::compile_codegen_unit
  30: rustc_trans::base::trans_crate
  31: <rustc_trans::LlvmTransCrate as rustc_trans_utils::trans_crate::TransCrate>::trans_crate
  32: rustc::util::common::time
  33: rustc_driver::driver::phase_4_translate_to_llvm
  34: rustc_driver::driver::compile_input::{{closure}}
  35: <std::thread::local::LocalKey<T>>::with
  36: <std::thread::local::LocalKey<T>>::with
  37: rustc::ty::context::TyCtxt::create_and_enter
  38: rustc_driver::driver::compile_input
  39: rustc_driver::run_compiler

error: Could not compile `openssl`.

@pietroalbini pietroalbini added C-bug Category: This is a bug. I-nominated labels Feb 15, 2018
@sfackler
Copy link
Member

Ah nice catch

@Mrmaxmeier
Copy link
Contributor

Mrmaxmeier commented Feb 18, 2018

For reference: This is a duplicate of #47309.

@nikomatsakis
Copy link
Contributor

Closing as duplicate of #47309 -- thanks for the report!

kennytm added a commit to kennytm/rust that referenced this issue Feb 27, 2018
…on-ice, r=michaelwoerister

Report non-standard compile flags on ICE

Some ICEs (such as the recent rust-lang#48248) only happens when a non-standard compiler flag is provided to rustc, but users don't always report the used flags. This can slow down reproducing the issue, so this PR shows all the non-standard compiler flags in the ICE error message.

For example, the output of rust-lang#48248 with this PR is:

```
error: internal compiler error: [...]

thread 'rustc' panicked at [...]
note: Run with `RUST_BACKTRACE=1` for a backtrace.

note: the compiler unexpectedly panicked. this is a bug.

note: we would appreciate a bug report: [...]

note: rustc 1.25.0-dev running on x86_64-unknown-linux-gnu

note: compiler flags: -C link-dead-code
```

### Open questions

* At the moment, only `-C` and `-Z` flags are shown by default, and all the ones provided by cargo in a standard build are ignored: I did this to only show the flags that probably caused the ICE, and to remove some noise from the message. This removed flags like `opt-level` and `debuginfo` though, could those be useful for reproducing ICEs?
kennytm added a commit to kennytm/rust that referenced this issue Feb 28, 2018
…on-ice, r=michaelwoerister

Report non-standard compile flags on ICE

Some ICEs (such as the recent rust-lang#48248) only happens when a non-standard compiler flag is provided to rustc, but users don't always report the used flags. This can slow down reproducing the issue, so this PR shows all the non-standard compiler flags in the ICE error message.

For example, the output of rust-lang#48248 with this PR is:

```
error: internal compiler error: [...]

thread 'rustc' panicked at [...]
note: Run with `RUST_BACKTRACE=1` for a backtrace.

note: the compiler unexpectedly panicked. this is a bug.

note: we would appreciate a bug report: [...]

note: rustc 1.25.0-dev running on x86_64-unknown-linux-gnu

note: compiler flags: -C link-dead-code
```

### Open questions

* At the moment, only `-C` and `-Z` flags are shown by default, and all the ones provided by cargo in a standard build are ignored: I did this to only show the flags that probably caused the ICE, and to remove some noise from the message. This removed flags like `opt-level` and `debuginfo` though, could those be useful for reproducing ICEs?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ regression-from-stable-to-stable Performance or correctness regression from one stable version to another. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

5 participants