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: 'assertion failed: index < LLVMCountParams(llfn)', ../src/librustc_llvm/lib.rs:2250 #26997

Closed
istankovic opened this issue Jul 12, 2015 · 4 comments
Labels
I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️

Comments

@istankovic
Copy link
Contributor

The compiler panics when trying to compile this code:

pub struct Foo {
    x: isize,
    y: isize
}

impl Foo {
    pub extern fn foo_new() -> Foo {
        Foo { x: 21, y: 33 }
    }
}

This is with

rustc 1.3.0-nightly (67256dff6 2015-07-09)
binary: rustc
commit-hash: 67256dff6dd7526f0be9da5092a6b3e390654c8c
commit-date: 2015-07-09
host: x86_64-unknown-linux-gnu
release: 1.3.0-nightly
$ RUST_BACKTRACE=1 rustc --crate-type dylib lib.rs 
lib.rs:2:5: 2:13 warning: struct field is never used: `x`, #[warn(dead_code)] on by default
lib.rs:2     x: isize,
             ^~~~~~~~
lib.rs:3:5: 3:13 warning: struct field is never used: `y`, #[warn(dead_code)] on by default
lib.rs:3     y: isize
             ^~~~~~~~
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 'assertion failed: index < LLVMCountParams(llfn)', ../src/librustc_llvm/lib.rs:2250

stack backtrace:
   1:     0x7f12dd59817e - sys::backtrace::write::h3ecf23ae317178b4Qqs
   2:     0x7f12dd59fe14 - panicking::on_panic::hffb5f62afcb56dacQ9w
   3:     0x7f12dd562d9e - rt::unwind::begin_unwind_inner::ha7a91c9abe288335uPw
   4:     0x7f12d7f2d413 - rt::unwind::begin_unwind::h16605897156115720580
   5:     0x7f12d7f2d3aa - get_param::hb188514a1386c943URc
   6:     0x7f12dc398104 - trans::base::init_function::hf129fb24e7ecd471MEh
   7:     0x7f12dc39c962 - trans::base::trans_closure::ha8dd63d3ab902b61WTh
   8:     0x7f12dc3a0927 - trans::base::trans_fn::hc037a1ceab32bd37J3h
   9:     0x7f12dc3a4518 - trans::base::trans_item::h3f8065230582e652Usi
  10:     0x7f12dc3b0c28 - trans::base::trans_crate::hf1e6e2ced94af1d9Rgj
  11:     0x7f12ddb06d14 - driver::phase_4_translate_to_llvm::h76638dba7a6bfe525Oa
  12:     0x7f12ddb01445 - driver::phase_3_run_analysis_passes::closure.15879
  13:     0x7f12ddafb69b - middle::ty::ctxt<'tcx>::create_and_enter::h9374423159988670676
  14:     0x7f12ddaf6641 - driver::phase_3_run_analysis_passes::h16611790442000187316
  15:     0x7f12ddad58bc - driver::compile_input::h518a192813f7b6ceTba
  16:     0x7f12ddbbc1a3 - run_compiler::h2692f9bb80088600A7b
  17:     0x7f12ddbb9b7e - boxed::F.FnBox<A>::call_box::h1854161409259061273
  18:     0x7f12ddbb93c9 - rt::unwind::try::try_fn::h13481957482458181815
  19:     0x7f12dd61ae78 - rust_try_inner
  20:     0x7f12dd61ae65 - rust_try
  21:     0x7f12dd58b4b7 - rt::unwind::try::inner_try::h497973a2166ac637nLw
  22:     0x7f12ddbb95db - boxed::F.FnBox<A>::call_box::h18176717890739738257
  23:     0x7f12dd59ea71 - sys::thread::Thread::new::thread_start::h1bd024404d1992a3aVv
  24:     0x7f12d723c353 - start_thread
  25:     0x7f12dd1f8bfc - __clone
  26:                0x0 - <unknown>
@Aatch
Copy link
Contributor

Aatch commented Jul 13, 2015

Arg, extern methods again! Seriously, can we get these made invalid already!

@steveklabnik steveklabnik added the I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ label Jul 16, 2015
@liebharc
Copy link

liebharc commented Dec 6, 2015

I've found this issue report since I just hit the same issue in my pet project. One thing which might be relevant is that Ivan's example compiles fine on my Windows machine and fails on my Linux machine. Both machines are running:

rustc 1.6.0-nightly (338cdd7e0 2015-11-24)

I just wrote a similar comment on #28502 since I'm facing both issues right now.

@Aatch, sorry I'm new to the Rust environment and I don't quite get your statement. Are you saying that extern is unnecessary in future or that it will be replaced?

@Aatch
Copy link
Contributor

Aatch commented Dec 6, 2015

@liebharc methods with the extern qualifier aren't well-behaved and cause bugs (like this one). Mostly because one part treats them like regular Rust functions and another part treats them like (in this case) C ABI functions.

@steveklabnik
Copy link
Member

As of last night's nightly, this no longer ICEs.

frewsxcv added a commit to frewsxcv/rust that referenced this issue Mar 22, 2016
eddyb added a commit to eddyb/rust that referenced this issue Mar 23, 2016
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

4 participants