-
Notifications
You must be signed in to change notification settings - Fork 386
Miri is confused by a variadic call in px4 #2191
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
Comments
This means that a function was declared as variadic, but called through a function pointer that is not variadic (or vice versa). As far as I know, there is no cross-platform promise that this will actually work (though it might work for some specific platform ABIs). But anyway, even if it passed this check, it would probably immediately run into the next check, which is that Miri does not support Rust-to-Rust calls of variadic functions. So, closing as a duplicate of #1892. |
Until we support variadics better, we can at least make the error less scary: rust-lang/rust#97767 |
What I do not understand is why we are even getting to that check. Looking at the source, this is just calling an My only explanation is that something somewhere is defining a Rust function with link_name px4_log_raw, but I have not found that definition yet. |
Ah, here it is. So that test passes a bunch of arguments to a function that expects none. Is it a guarantee of all calling conventions that passing extra arguments is fine? |
It is UB according to the C specification. Rustc warns about clashing function declarations within the same crate. (and cg_clif simply crashes on cranelift returning an error from |
Ouch, I totally missed that declaration. I think it is definitely valid for Miri to report a problem here. This declaration vs definition issue is something C++ was trying to deal with in the 80s with name mangling. |
Yay more confusion with variadics
https://miri.saethlin.dev/ub?crate=px4&version=0.2.4
I don't know what a variadic call site means. But this looks like a perfectly valid call to me, all the variadic arguments fit in a
usize
. It's not possible to type check a variadic call without knowing how the callee is going to interpret things, so I feel like we should either be quiet on the issue or reject them altogether?The text was updated successfully, but these errors were encountered: