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

ICE when linking two extern functions to the same function, but with different signatures #5791

Closed
doy opened this issue Apr 9, 2013 · 5 comments · Fixed by #9805
Closed
Labels
E-needs-test Call for participation: An issue has been fixed and does not reproduce, but no test has been added.

Comments

@doy
Copy link
Contributor

doy commented Apr 9, 2013

extern {
    #[link_name = "malloc"]
    fn malloc1(len: libc::c_int) -> *libc::c_void;
    #[link_name = "malloc"]
    fn malloc2(len: libc::c_int, foo: libc::c_int) -> *libc::c_void;
}

fn main () { }
rustc: /build/src/rust-0.6/src/llvm/include/llvm/Support/Casting.h:197: typename llvm::cast_retty<To, From>::ret_type llvm::cast(const Y&) [with X = llvm::Function; Y = llvm::Value*; typename llvm::cast_retty<To, From>::ret_type = llvm::Function*]: Assertion `isa<X>(Val) && "cast<Ty>() argument of incompatible type!"' failed.
zsh: abort (core dumped)  rustc test3.rs
@metajack
Copy link
Contributor

There's a slightly different error message now:

Assertion failed: (isa<X>(Val) && "cast<Ty>() argument of incompatible type!"), function cast, file /Users/jack/src/servo2/src/compiler/rust/src/llvm/include/llvm/Support/Casting.h, line 231.
Abort trap: 6

Nominating for production ready (thought might be just a bug).

@emberian
Copy link
Member

emberian commented Aug 5, 2013

It has changed again:

rustc: /home/cmr/hacking/rust/src/llvm/include/llvm/Support/Casting.h:237: typename llvm::enable_if<llvm::is_same<Y, typename llvm::simplify_type<From>::SimpleType>, typename llvm::cast_retty<X, Y*>::ret_type>::type llvm::cast(Y*) [with X = llvm::Function; Y = llvm::Value; typename llvm::enable_if<llvm::is_same<Y, typename llvm::simplify_type<From>::SimpleType>, typename llvm::cast_retty<X, Y*>::ret_type>::type = llvm::Function*]: Assertion `isa<X>(Val) && "cast<Ty>() argument of incompatible type!"' failed.

@nikomatsakis
Copy link
Contributor

I think this is fixed in my PR for #3678 (not yet landed)

@graydon
Copy link
Contributor

graydon commented Aug 15, 2013

accepted for production-ready milestone

@alexcrichton
Copy link
Member

This has been since fixed (presumably by @nikomatsakis's work), removing the red tags and flagging as needstest.

bors added a commit that referenced this issue Oct 11, 2013
jumbatm added a commit to jumbatm/rust that referenced this issue Apr 18, 2020
jumbatm added a commit to jumbatm/rust that referenced this issue May 20, 2020
- Allow ClashingExternDecl for lint-dead-code-3
- Update test case for rust-lang#5791
- Update test case for rust-lang#1866
- Update extern-abi-from-macro test case
jumbatm added a commit to jumbatm/rust that referenced this issue May 23, 2020
- Allow ClashingExternDecl for lint-dead-code-3
- Update test case for rust-lang#5791
- Update test case for rust-lang#1866
- Update extern-abi-from-macro test case
jumbatm added a commit to jumbatm/rust that referenced this issue May 30, 2020
- Allow ClashingExternDecl for lint-dead-code-3
- Update test case for rust-lang#5791
- Update test case for rust-lang#1866
- Update extern-abi-from-macro test case
jumbatm added a commit to jumbatm/rust that referenced this issue Jun 20, 2020
- Allow ClashingExternDecl for lint-dead-code-3
- Update test case for rust-lang#5791
- Update test case for rust-lang#1866
- Update extern-abi-from-macro test case
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.

6 participants