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

LLVM assertion failure with moving boxed DST #35546

Closed
apasel422 opened this Issue Aug 9, 2016 · 4 comments

Comments

Projects
None yet
5 participants
@apasel422
Copy link
Member

apasel422 commented Aug 9, 2016

The following successfully typechecks on rustc 1.12.0-nightly (b30eff7ba 2016-08-05), but generates an LLVM assertion failure:

struct Node<T: ?Sized + Send> {
    next: Option<Box<Node<Send>>>,
    value: T,
}

fn clear(head: &mut Option<Box<Node<Send>>>) {
    while let Some(node) = head.take() {
        *head = node.next;
    }
}

fn main() {}

Error:

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

Note that replacing *head = node.next with *head = node.next.take() (and making node mutable) allows compilation to succeed.

@TimNN

This comment has been minimized.

Copy link
Contributor

TimNN commented Sep 6, 2016

First occurs in nightly-2016-08-03 which turns on mir by default, does not occur on nightly-2016-08-03 with -Z orbit=off.

@TimNN

This comment has been minimized.

Copy link
Contributor

TimNN commented Sep 10, 2016

Using -Z orbit this was introduced between nightly-2016-06-05 and nightly-2016-06-06 (Changes).

@nikomatsakis

This comment has been minimized.

Copy link
Contributor

nikomatsakis commented Sep 13, 2016

Problem seems to be that we call the drop with a fat pointer as 2 arguments, but it expects a pointer to a tuple.

@nikomatsakis

This comment has been minimized.

Copy link
Contributor

nikomatsakis commented Sep 13, 2016

I have a fix for this, running the full make check locally now to see if I broke anything else on the way.

bors added a commit that referenced this issue Sep 14, 2016

Auto merge of #36459 - nikomatsakis:issue-35546, r=eddyb
invoke drop glue with a ptr to (data, meta)

This is done by creating a little space on the stack. Hokey, but it's the simplest fix I can see, and I am in "kill regressions" mode right now.

Fixes #35546

r? @eddyb

Manishearth added a commit to Manishearth/rust that referenced this issue Sep 15, 2016

Rollup merge of rust-lang#36459 - nikomatsakis:issue-35546, r=eddyb
invoke drop glue with a ptr to (data, meta)

This is done by creating a little space on the stack. Hokey, but it's the simplest fix I can see, and I am in "kill regressions" mode right now.

Fixes rust-lang#35546

r? @eddyb

@bors bors closed this in #36459 Sep 15, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.