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

Debuginfo is emitted for some unreachable code, crashes #21559

Closed
Jojoshua opened this issue Jan 23, 2015 · 11 comments
Closed

Debuginfo is emitted for some unreachable code, crashes #21559

Jojoshua opened this issue Jan 23, 2015 · 11 comments
Labels
A-debuginfo Area: Debugging information in compiled programs (DWARF, PDB, etc.) I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️

Comments

@Jojoshua
Copy link

error: internal compiler error: debuginfo::create_local_var_metadata() - Referenced variable location is not an alloca!
Test.rs:131 let take = if num_items <= split_by {
^~~~
note: the compiler unexpectedly panicked. this is a bug.
note: we would appreciate a bug report: http://doc.rust-lang.org/complement-bugreport.html
note: run with RUST_BACKTRACE=1 for a backtrace
thread 'rustc' panicked at 'Box', C:\bot\slave\nightly-dist-rustc-win-64\build\src\libsyntax\diagnostic.rs:130

@steveklabnik
Copy link
Member

Can you share the code please?

@steveklabnik steveklabnik added the I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ label Jan 23, 2015
@Jojoshua
Copy link
Author

Maybe it is a cargo issue. I was using cargo build but rustc worked

fn main(){

return; 
let num_items = 100;
let mut split_by = 50;
let mut start_at = 0;
let mut count = 0;  
let take = if num_items <= split_by { 
              split_by = 1;               
              num_items //Take all items at once in this case
            } else {                    
                num_items / split_by    // Take x number at a time                      
            };  

}

@jdm jdm added the A-debuginfo Area: Debugging information in compiled programs (DWARF, PDB, etc.) label Jan 23, 2015
@jdm
Copy link
Contributor

jdm commented Jan 23, 2015

The Cargo build adds -g by default, which is what triggers this.

@jdm
Copy link
Contributor

jdm commented Jan 23, 2015

What version of rustc are you using (rustc --version)? This looks very similar to #20312.

@Jojoshua
Copy link
Author

I am using the latest version (installed today).

@Jojoshua
Copy link
Author

Yes 20312 looks exactly the same.

@jdm
Copy link
Contributor

jdm commented Jan 23, 2015

cc @michaelwoerister

@michaelwoerister
Copy link
Member

Hm, maybe the LLVM basic-blocks in the nested expressions are not marked as unreachable during trans?

@michaelwoerister michaelwoerister changed the title ICE rustc panicked at Box<Any> Debuginfo is emitted for some unreachable code, crashes Mar 4, 2015
@michaelwoerister
Copy link
Member

PR #23066 which fixes this (but needs close review for unintended side-effects) is open for a while now. Nothing new on this issue otherwise.

Manishearth added a commit to Manishearth/rust that referenced this issue Apr 1, 2015
…pnkfelix

This PR solves rust-lang#21559 by making sure that unreachable if-expressions are not further translated.

Could someone who knows their way around `trans` take a look at the changes in `controlflow.rs`? I'm not sure if any other code relies on any side-effects of translating unreachable things.

cc @nikomatsakis @nrc @eddyb
@pmarcelll
Copy link
Contributor

Seems to be fixed.

@alexcrichton
Copy link
Member

Thanks @pmarcelll!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-debuginfo Area: Debugging information in compiled programs (DWARF, PDB, etc.) I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️
Projects
None yet
Development

No branches or pull requests

6 participants