]> git.lizzy.rs Git - rust.git/blob - tests/fail/shim_arg_size.rs
pointer tag tracking: on creation, log the offsets it is created for
[rust.git] / tests / fail / shim_arg_size.rs
1 // stderr-per-bitwidth
2
3 fn main() {
4     extern "C" {
5         // Use the wrong type(ie. not the pointer width) for the `size`
6         // argument.
7         #[cfg(target_pointer_width = "64")]
8         fn malloc(size: u32) -> *mut std::ffi::c_void;
9
10         #[cfg(target_pointer_width = "32")]
11         fn malloc(size: u16) -> *mut std::ffi::c_void;
12     }
13
14     unsafe {
15         let _p1 = malloc(42); //~ ERROR Undefined Behavior: scalar size mismatch
16     };
17 }