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 when compiling with -g #19575

Closed
Kintaro opened this issue Dec 5, 2014 · 5 comments · Fixed by #19581
Closed

LLVM assertion when compiling with -g #19575

Kintaro opened this issue Dec 5, 2014 · 5 comments · Fixed by #19581
Labels
A-closures Area: Closures (`|…| { … }`) A-debuginfo Area: Debugging information in compiled programs (DWARF, PDB, etc.) I-crash Issue: The compiler crashes (SIGSEGV, SIGABRT, etc). Use I-ICE instead when the compiler panics.

Comments

@Kintaro
Copy link
Contributor

Kintaro commented Dec 5, 2014

@bstrie So, this code raises an assertion in llvm when compiling with -g. Without -g it works fine.

#![feature(unboxed_closures)]

pub struct A;

impl A {
    pub fn foo(&self, f: Box<Fn<(), ()> + 'static>) ->
            Box<Fn<(), ()> + 'static> {
        (box move |&:| {
            (*f).call(())
        })
    }
}

Raised assertion is

rustc: /home/rustbuild/src/rust-buildbot/slave/nightly-linux/build/src/llvm/lib/IR/Instructions.cpp:1086: void llvm::StoreInst::AssertOK(): Assertion `getOperand(0)->getType() == cast<PointerType>(getOperand(1)->getType())->getElementType() && "Ptr must be a pointer to Val type!"' failed.
[1]    1800 abort (core dumped)  rustc --crate-type lib test.rs -g

Edit: reduced code more

@bstrie bstrie added A-closures Area: Closures (`|…| { … }`) A-debuginfo Area: Debugging information in compiled programs (DWARF, PDB, etc.) I-crash Issue: The compiler crashes (SIGSEGV, SIGABRT, etc). Use I-ICE instead when the compiler panics. labels Dec 5, 2014
@bstrie bstrie mentioned this issue Dec 5, 2014
47 tasks
@japaric
Copy link
Member

japaric commented Dec 5, 2014

Duplicate of #17257? (there are some comments with unboxed closures and -g/--debuginfo)

@Kintaro
Copy link
Contributor Author

Kintaro commented Dec 5, 2014

It worked with the rustc versions from around last week. Especially the rustup versions.
A friend just tested it with his "old" version from 11/26, and it still works there.

So either it's new or it's a regression bug.

@luqmana
Copy link
Member

luqmana commented Dec 5, 2014

cc @michaelwoerister

@michaelwoerister
Copy link
Member

I'll look into it.

@Kintaro
Copy link
Contributor Author

Kintaro commented Dec 5, 2014

I suspect the culprit is make_return_slot_pointer in librustc_trans::trans::builder

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-closures Area: Closures (`|…| { … }`) A-debuginfo Area: Debugging information in compiled programs (DWARF, PDB, etc.) I-crash Issue: The compiler crashes (SIGSEGV, SIGABRT, etc). Use I-ICE instead when the compiler panics.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants