Description
For instance, consider:
extern "C" {
fn pipe(pipefd: [i32; 2]) -> i32;
}
fn main() {
let mut fds: [i32; 2] = [0; 2];
assert_eq!(unsafe { pipe(fds) }, 0);
}
I think to fix this properly we need to completely re-do the way we handle shim arguments: every OpTy
needs to be transmuted to the right type before we do anything else with it. And we can't just just call OpTy::transmute
as that can't be used for arbitrary transmute, e.g. changing ABIs can fail spectacularly.
Once this is consistently done everywhere, we can also remove the ScalarSizeMismatch error from the interpreter. This was added because otherwise ICEs can be triggered by using an incorrect scalar type in the signature of a function that has a Miri shim, but as we have seen, ICEs can still be triggered -- and once we use our own hard-coded types everywhere, ScalarSizeMismatch can no longer be triggered at all.
We probably want a macro that helps with that.