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

Mir: translation of Lvalue::ReturnPointer ICEs for functions without return type #30480

Closed
nagisa opened this issue Dec 19, 2015 · 1 comment · Fixed by #30481
Closed

Mir: translation of Lvalue::ReturnPointer ICEs for functions without return type #30480

nagisa opened this issue Dec 19, 2015 · 1 comment · Fixed by #30481
Labels
A-MIR Area: Mid-level IR (MIR) - https://blog.rust-lang.org/2016/04/19/MIR.html I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️

Comments

@nagisa
Copy link
Member

nagisa commented Dec 19, 2015

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
thread 'rustc' panicked at 'called `Option::unwrap()` on a `None` value', src/libcore/option.rs:330
stack backtrace:
   1:     0x7f09530f98de - sys::backtrace::tracing::imp::write::h7557e2ce169dfa4119t
   2:     0x7f09531009c5 - panicking::log_panic::closure.41813
   3:     0x7f0953100465 - panicking::log_panic::h56b78895bafbce42lhy
   4:     0x7f09530c78e3 - sys_common::unwind::begin_unwind_inner::h6d6c187a6f5c73b5X0s
   5:     0x7f09530c8267 - sys_common::unwind::begin_unwind_fmt::h4af1494f5de9b7cb3Zs
   6:     0x7f09530f7771 - rust_begin_unwind
   7:     0x7f095311283f - panicking::panic_fmt::h307c1afa6e9b377breJ
   8:     0x7f095310cd48 - panicking::panic::h00907b475580f497YcJ
   9:     0x7f0951b7bb87 - trans::mir::lvalue::MirContext<'bcx, 'tcx>::trans_lvalue::ha96b32c5da76fc05ruO
  10:     0x7f0951a90073 - trans::mir::trans_mir::h96dd1e8056a72b5clNN
  11:     0x7f0951a8a998 - trans::base::trans_closure::h9b514d50ac62ad26vdj
  12:     0x7f0951a92cbc - trans::base::trans_fn::h1126368745048aa2Enj
  13:     0x7f0951a97285 - trans::base::trans_item::ha15e0b1de8fab2e8rNj
  14:     0x7f0951aa38c0 - trans::base::trans_crate::h8f18fa6f69635785zzk
  15:     0x7f095362fe7a - driver::phase_4_translate_to_llvm::hc6d3ed6089be6c3e7Ua
  16:     0x7f0953629c17 - driver::phase_3_run_analysis_passes::closure.23288
  17:     0x7f0953607965 - middle::ty::context::ctxt<'tcx>::create_and_enter::h14213449263107283385
  18:     0x7f09536030c9 - driver::phase_3_run_analysis_passes::h13029203733993090974
  19:     0x7f09535e6c8d - driver::compile_input::h3952c7f29b895d23jca
  20:     0x7f0953748ecb - run_compiler::h1bb4927bc0bc5681Vyc
  21:     0x7f09537460f8 - sys_common::unwind::try::try_fn::h16299814252884817712
  22:     0x7f09530f75d8 - __rust_try
  23:     0x7f09530ee66b - sys_common::unwind::try::inner_try::h5a09ecc8aa81bdabvXs
  24:     0x7f0953746420 - boxed::F.FnBox<A>::call_box::h18362388286111528028
  25:     0x7f09530fec53 - sys::thread::Thread::new::thread_start::h66f81bdcccd0ead1yjx
  26:     0x7f094cdd74a3 - start_thread
  27:     0x7f0952d8c13c - clone
  28:                0x0 - <unknown>

This happens because functions like

fn nil(){}

have no return type, but rustc_trans::mir::lvalue::trans_lvalue unwraps the option when translating the ReturnPointer Lvalue.

@apasel422 apasel422 added the I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ label Dec 19, 2015
@eddyb eddyb added the A-MIR Area: Mid-level IR (MIR) - https://blog.rust-lang.org/2016/04/19/MIR.html label Dec 19, 2015
@nikomatsakis
Copy link
Contributor

...unwraps the option when translating the ReturnPointer Lvalue....

do you mean it unwraps the FnOutput? In that case, I expect the example should be fn nil() -> ! { }?

nagisa added a commit to nagisa/rust that referenced this issue Jan 6, 2016
bors added a commit that referenced this issue Jan 6, 2016
r? @nikomatsakis

This is a pretty big PR conflating changes to a few different block terminators (Call, DivergingCall, Panic, Resume, Diverge), because they are somewhat closely related.

Each commit has a pretty good description on what is being changed in each commit. The end result is greatly simplified CFG and translation for calls (no success branch if the function is diverging, no cleanup branch if there’s nothing to cleanup etc).

Fixes #30480
Fixes #29767
Partialy solves #29575
Fixes #29573
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-MIR Area: Mid-level IR (MIR) - https://blog.rust-lang.org/2016/04/19/MIR.html 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.

4 participants