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 getting a reference out of tuple #4760

Closed
erickt opened this issue Feb 2, 2013 · 5 comments
Closed

LLVM assertion getting a reference out of tuple #4760

erickt opened this issue Feb 2, 2013 · 5 comments
Labels
A-codegen Area: Code generation I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️

Comments

@erickt
Copy link
Contributor

erickt commented Feb 2, 2013

Alexander was having trouble on the mailing list doing this:

pub trait TupleVal<T> {
    pub pure fn _1(&self) -> &self/T;
}

impl <T>(T, T): TupleVal<T> {
    pure fn _1(&self) -> &self/T {
        //match *self { (ref a, _) => a }
        let &(ref a, _) = self;
        a
    }
}

fn main() {
    let pair = (1, 2);
    let left = *pair._1();
    io::println(fmt!("pair left: %u", left));
}

This results in the following llvm error:

Assertion failed: (getOperand(0)->getType() == cast<PointerType>(getOperand(1)->getType())->getElementType() && "Ptr must be a pointer to Val type!"), function AssertOK, file /Users/erickt/Projects/rust/rust/src/llvm/lib/VMCore/Instructions.cpp, line 1062

If instead we use the commented out llvm form, it compiles and runs perfectly fine, so the let destructuring mechanism is probably to blame. @catamorphism: You wrote that code, right? Can you take a look at this?

Also, I ran into a similar llvm assertion in #4759, so maybe it's the same bug.

@alexcrichton
Copy link
Member

I was having similar problems in #4653

@sanxiyn
Copy link
Member

sanxiyn commented Feb 26, 2013

It seems to be a yet another instance of #3235.

@graydon
Copy link
Contributor

graydon commented Mar 22, 2013

reproduced on 2013-03-22

@graydon
Copy link
Contributor

graydon commented Mar 22, 2013

non-critical for 0.6, de-milestoning

@thestinger
Copy link
Contributor

Closing as duplicate of #4653.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-codegen Area: Code generation I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️
Projects
None yet
Development

No branches or pull requests

5 participants