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

"Calling a function with a bad signature!"' failed. #22663

Closed
dpc opened this issue Feb 22, 2015 · 1 comment · Fixed by #22667
Closed

"Calling a function with a bad signature!"' failed. #22663

dpc opened this issue Feb 22, 2015 · 1 comment · Fixed by #22667
Labels
I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️

Comments

@dpc
Copy link
Contributor

dpc commented Feb 22, 2015

I was able to crash compiler (rustc 1.0.0-nightly (522d09d 2015-02-19) (built 2015-02-21)
) :

rustc: /home/rustbuild/src/rust-buildbot/slave/nightly-dist-rustc-linux/build/src/llvm/lib/IR/Instructions.cpp:281: void llvm::CallInst::init(llvm::Value*, llvm::ArrayRef<llvm::Value*>, const llvm::Twine&): Assertion `(i >= FTy->getNumParams() || FTy->getParamType(i) == Args[i]->getType()) && "Calling a function with a bad signature!"' failed.

with: https://github.com/dpc/rhex/tree/0dbf5b7f861638e59f367170b21b6b5ee9b286f7

and it turned out that this is a small change:

dpc/rhex@17487b8

that fixes the crash. I hope it's helpful.

@dotdash
Copy link
Contributor

dotdash commented Feb 22, 2015

Thanks for the bug report!

Reduced testcase:

pub fn fail(x: Option<& (Iterator+Send)>) -> Option<&Iterator> {
    inner(x)
}

pub fn inner(x: Option<& (Iterator+Send)>) -> Option<&(Iterator+Send)> {
    x
}

fn main() {}

The problem is that LLVM gets distinct types for Option<&Trait> and Option<&(Trait+Bound)> and sees the call as invalid.

FWIW, you could also have changed your At::item() function to return Option<&'a (Item+Send+Sync)> to make the error go away

dotdash added a commit to dotdash/rust that referenced this issue Feb 22, 2015
We already do this for the function arguments, but miss it for the
retslot pointer, which can lead to LLVM assertions because the retslot
has the wrong type.

Fixes rust-lang#22663
@steveklabnik steveklabnik added the I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ label Feb 23, 2015
Manishearth added a commit to Manishearth/rust that referenced this issue Feb 23, 2015
 We already do this for the function arguments, but miss it for the
retslot pointer, which can lead to LLVM assertions because the retslot
has the wrong type.

Fixes rust-lang#22663
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

Successfully merging a pull request may close this issue.

3 participants