You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Modified test case causing llvm assertion error on x64:
mod a {extern{fnfunc();// declare void @func() unnamed_addr}}mod b {structS{a:u64,b:u64,c:u64,}extern{fnfunc(s:S);// declare void @func(%"struct.b::S"* byval) unnamed_addr}}
rustc: /media/a/lime/src/rust/src/llvm/include/llvm/Support/Casting.h:240:typename llvm::cast_retty<X, Y*>::ret_type llvm::cast(Y*) [with X = llvm::Argument; Y = llvm::Value; typename llvm::cast_retty<X, Y*>::ret_type = llvm::Argument*]: Assertion `isa<X>(Val) && "cast<Ty>() argument of incompatible type!"' failed.
klutzy's test case is causing a different error now on 64-bit Linux:
Attribute after last parameter!
void ()* @func
LLVM ERROR: Broken module found, compilation aborted!
Are duplicate declarations useful/necessary for calling functions like objc_msgSend? IIRC, that function isn't really varargs -- the prototype varies depending upon which ObjC method is invoked. (I discovered this GitHub issue because I did something similar to objc_msgSend.)
On x86-64 as well, does not reproduce with --crate-type lib and rustc 1.18.0-nightly (bbdaad0dc 2017-04-14). Going to presume the assertions are fixed, but the original issue (multiple externs with the same name) isn't, so leaving open.
The rustc compiler does throw warnings when we use two conflicting function signatures in extern declarations. So, shall we change this to disallow it and instead throw an error?
objc_msgSend is declared with multiple signatures in libstd. The signature of this function depends on the message sent. It forwards all arguments to the called method. Declaring it as a vararg function is not valid in AArch64 due to ABI differences.
objc_msgSend is declared with multiple signatures in libstd. The signature of this function depends on the message sent. It forwards all arguments to the called method. Declaring it as a vararg function is not valid in AArch64 due to ABI differences.
Since #117910, this is no longer true, instead we explicitly cast the function pointer (which is arguably the more correct behaviour, at least it's what the C headers also declare and expect you to do).
Activity
brson commentedon Mar 5, 2014
This would disallow duplicate functions with different signatures, but still allow duplicate with the same?
klutzy commentedon Mar 5, 2014
I thought identical duplicates are ok because
make check-fastneeds them. Some rpass tests use same extern fn then they are combined into one crate.rustc: Fix x86 ffi for struct arguments
klutzy commentedon Mar 10, 2014
Modified test case causing llvm assertion error on x64:
In the case, argument has
byvalattribute.klutzy commentedon Mar 10, 2014
cc #12762:
it contains a patch to suppress llvm assertion error above.Not really.rprichard commentedon Oct 17, 2014
klutzy's test case is causing a different error now on 64-bit Linux:
Are duplicate declarations useful/necessary for calling functions like
objc_msgSend? IIRC, that function isn't really varargs -- the prototype varies depending upon which ObjC method is invoked. (I discovered this GitHub issue because I did something similar toobjc_msgSend.)steveklabnik commentedon Dec 31, 2015
Traige: Still getting the same failure as @rprichard , but I'm also on x86-64. Does this fail everywhere now?
Mark-Simulacrum commentedon Apr 15, 2017
On x86-64 as well, does not reproduce with
--crate-type libandrustc 1.18.0-nightly (bbdaad0dc 2017-04-14). Going to presume the assertions are fixed, but the original issue (multiple externs with the same name) isn't, so leaving open.steveklabnik commentedon Sep 24, 2018
Triage: no change
BurgundyWillow commentedon Dec 9, 2020
The rustc compiler does throw warnings when we use two conflicting function signatures in extern declarations. So, shall we change this to disallow it and instead throw an error?
bjorn3 commentedon May 31, 2023
objc_msgSendis declared with multiple signatures in libstd. The signature of this function depends on the message sent. It forwards all arguments to the called method. Declaring it as a vararg function is not valid in AArch64 due to ABI differences.Rollup merge of rust-lang#117910 - madsmtm:msg-send-no-clashing, r=th…
Rollup merge of rust-lang#117910 - madsmtm:msg-send-no-clashing, r=th…
Unrolled build for rust-lang#117910
madsmtm commentedon Jan 22, 2024
Since #117910, this is no longer true, instead we explicitly cast the function pointer (which is arguably the more correct behaviour, at least it's what the C headers also declare and expect you to do).