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 "Ptr must be a pointer to Val type!" failed. #6470

Closed
ILyoan opened this issue May 14, 2013 · 8 comments · Fixed by #9805
Closed

LLVM assertion "Ptr must be a pointer to Val type!" failed. #6470

ILyoan opened this issue May 14, 2013 · 8 comments · Fixed by #9805
Labels
E-needs-test Call for participation: An issue has been fixed and does not reproduce, but no test has been added.

Comments

@ILyoan
Copy link
Contributor

ILyoan commented May 14, 2013

Compiling this code yield LLVM assertion "Ptr must be a pointer to Val type!"

pub mod Bar {
    pub struct Foo {
        v: int,
    }

    extern {
        #[rust_stack]
        pub fn foo(v: *Foo) -> Foo;
    }
}

fn main() { }

rustc: /home/ilyoan/project/rust/rust/src/llvm/lib/IR/Instructions.cpp:1084: void llvm::StoreInst::AssertOK(): Assertion `getOperand(0)->getType() == cast(getOperand(1)->getType())->getElementType() && "Ptr must be a pointer to Val type!"' failed.

@ILyoan
Copy link
Contributor Author

ILyoan commented May 14, 2013

#4653, #4760 and #6390 produce the same error message, but I'm not sure if those are the same issue.

@catamorphism
Copy link
Contributor

Reproduced 93c270c -- nominating for milestone 5, production-ready

@catamorphism
Copy link
Contributor

Note that #4653, #4760, and #6390 are all fixed, so this is a different bug (this is a common error message with many different causes).

@graydon
Copy link
Contributor

graydon commented Jul 18, 2013

Reproduced. Slight minimization: if you switch the return value to a *Foo it gets through translation. So I think it's just the unhandled combination of #[rust_stack], extern and return-by-structure.

@catamorphism
Copy link
Contributor

0266172 added a test (run-pass/issue-6470.rs)

@catamorphism
Copy link
Contributor

accepted for production-ready

@nikomatsakis
Copy link
Contributor

I am a bit surprised this doesn't work; it will probably depend on the specific ABI we test

@alexcrichton
Copy link
Member

This code now compiles, looks like the test just needs to be un-xfail'd. Flagging as needstest

bors added a commit that referenced this issue Oct 11, 2013
flip1995 pushed a commit to flip1995/rust that referenced this issue Dec 20, 2020
…in-docs, r=flip1995

Renamed the good first issue label in CONTRIBUTING.md

Follow up from rust-lang#6468

Grep found some more references to the old `good first issue`.

[CONTRIBUTING.md rendered](https://github.com/xFrednet/rust-clippy/blob/0000-rename-good-first-issue-in-docs/CONTRIBUTING.md)

<details>
<summary>grep output</summary>

```
$ grep -Ri "good first issue" rust-clippy/
rust-clippy/.git/COMMIT_EDITMSG:Renamed the good first issue label in CONTRIBUTING.md
rust-clippy/.git/logs/HEAD:896d82f7ff64644656bda7a4ed8bbd55ca3b7619 1f58c2b xFrednet <xFrednet@gmail.com> 1608326295 +0000     commit: Renamed the good first issue label for rustbot
rust-clippy/.git/logs/HEAD:9be704584f05e5a6c3ba2708590f98c1f261d19a ced54f2 xFrednet <xFrednet@gmail.com> 1608329602 +0000     commit: Renamed the good first issue label in CONTRIBUTING.md
rust-clippy/.git/logs/refs/heads/0000-rename-good-first-issue-in-docs:896d82f7ff64644656bda7a4ed8bbd55ca3b7619 1f58c2b xFrednet <xFrednet@gmail.com> 1608326295 +0000  commit: Renamed the good first issue label for rustbot
rust-clippy/.git/logs/refs/heads/0000-rename-good-first-issue-in-docs:9be704584f05e5a6c3ba2708590f98c1f261d19a ced54f2 xFrednet <xFrednet@gmail.com> 1608329602 +0000  commit: Renamed the good first issue label in CONTRIBUTING.md
rust-clippy/CONTRIBUTING.md:Some issues are easier than others. The [`good first issue`] label can be used to find the easy issues.
rust-clippy/CONTRIBUTING.md:[`E-medium`] issues are generally pretty easy too, though it's recommended you work on an [`good first issue`]
rust-clippy/CONTRIBUTING.md:[`good first issue`]: https://github.com/rust-lang/rust-clippy/labels/good%20first%20issue
```
</details>

---

changelog: None

r? `@flip1995`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
E-needs-test Call for participation: An issue has been fixed and does not reproduce, but no test has been added.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants