Closed
Description
In the following example, bar
optimizes to ret i8 undef
because the return value is cast into an i32
in foo
and has to be converted back at the call site. The old trans code does this with a gnarly memcpy
which should handle all of the possible situations, if the comment on it is of any indication.
I believe my use of ArgType::store
for storing the return value in its destination was unwarranted.
Since then, @Aatch has refactored that logic into its own function, which should do the memcpy
.
cc @nagisa @dotdash
#![crate_type = "lib"]
#![feature(rustc_attrs)]
pub extern "C" fn foo() -> (u8, u8, u8) {
(1, 2, 3)
}
#[rustc_mir]
pub fn bar() -> u8 {
foo().2
}