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
{{ message }}
Repository navigation
ICE: empty struct + extern function on 32-bit OS #16441
The reason for this seems to be that we mark zero-sized structs as Ignore in middle::trans::cabi_x86 and thus when we create the foreign wrapper function it doesn't have as many arguments as we expected. Whereas with x86_64 we never mark any arguments as Ignore. I'm not sure as to whether we want to go one way or the other.
I just checked with clang, and it always ignores empty structs (tried i686, x86_64, mips and arm targets), though it doesn't seem to affect the generated asm whether or not the argument is present, as long as it's passed as a direct argument (only tried on i686 and x86_64). The problem we had before, which was resolved by introducing the "Ignore" arg kind by @klutzy was that like all structs, the empty struct was passed as an indirect argument on x86. And that messed up the ffi since it used stack space.
It's a bit sad, since it complicates things, but I guess we should be doing the same as clang here and simply ignore empty structs. Maybe it can be done a bit easier if we make it so that it's not platform specific but done for all foreign functions?
Activity
luqmana commentedon Aug 12, 2014
The reason for this seems to be that we mark zero-sized structs as
Ignoreinmiddle::trans::cabi_x86and thus when we create the foreign wrapper function it doesn't have as many arguments as we expected. Whereas with x86_64 we never mark any arguments asIgnore. I'm not sure as to whether we want to go one way or the other.cc @dotdash any opinions on this?
dotdash commentedon Aug 13, 2014
I just checked with clang, and it always ignores empty structs (tried i686, x86_64, mips and arm targets), though it doesn't seem to affect the generated asm whether or not the argument is present, as long as it's passed as a direct argument (only tried on i686 and x86_64). The problem we had before, which was resolved by introducing the "Ignore" arg kind by @klutzy was that like all structs, the empty struct was passed as an indirect argument on x86. And that messed up the ffi since it used stack space.
It's a bit sad, since it complicates things, but I guess we should be doing the same as clang here and simply ignore empty structs. Maybe it can be done a bit easier if we make it so that it's not platform specific but done for all foreign functions?
Fix handling of ignored arguments in FFI wrappers for rust functions
auto merge of #16484 : dotdash/rust/empty_struct_wrapper_arg, r=luqmana
Auto merge of rust-lang#16441 - Young-Flash:exclude_tests_refs, r=Vey…