make shim_arg_size ptr-width-independent
This commit is contained in:
parent
671a4b8b0f
commit
1135ad31ab
@ -1,15 +0,0 @@
|
|||||||
error: Undefined Behavior: scalar size mismatch: expected 8 bytes but got 4 bytes instead
|
|
||||||
--> $DIR/shim_arg_size.rs:LL:CC
|
|
||||||
|
|
|
||||||
LL | let _p1 = malloc(42);
|
|
||||||
| ^^^^^^^^^^ scalar size mismatch: expected 8 bytes but got 4 bytes instead
|
|
||||||
|
|
|
||||||
= help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior
|
|
||||||
= help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information
|
|
||||||
= note: BACKTRACE:
|
|
||||||
= note: inside `main` at $DIR/shim_arg_size.rs:LL:CC
|
|
||||||
|
|
||||||
note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace
|
|
||||||
|
|
||||||
error: aborting due to previous error
|
|
||||||
|
|
@ -1,17 +1,10 @@
|
|||||||
//@stderr-per-bitwidth
|
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
extern "C" {
|
extern "C" {
|
||||||
// Use the wrong type(ie. not the pointer width) for the `size`
|
// Use the wrong type (ie. not `i32`) for the `c` argument.
|
||||||
// argument.
|
fn memchr(s: *const std::ffi::c_void, c: u8, n: usize) -> *mut std::ffi::c_void;
|
||||||
#[cfg(target_pointer_width = "64")]
|
|
||||||
fn malloc(size: u32) -> *mut std::ffi::c_void;
|
|
||||||
|
|
||||||
#[cfg(target_pointer_width = "32")]
|
|
||||||
fn malloc(size: u16) -> *mut std::ffi::c_void;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
unsafe {
|
unsafe {
|
||||||
let _p1 = malloc(42); //~ ERROR: Undefined Behavior: scalar size mismatch
|
memchr(std::ptr::null(), 0, 0); //~ ERROR: Undefined Behavior: scalar size mismatch
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
error: Undefined Behavior: scalar size mismatch: expected 4 bytes but got 2 bytes instead
|
error: Undefined Behavior: scalar size mismatch: expected 4 bytes but got 1 bytes instead
|
||||||
--> $DIR/shim_arg_size.rs:LL:CC
|
--> $DIR/shim_arg_size.rs:LL:CC
|
||||||
|
|
|
|
||||||
LL | let _p1 = malloc(42);
|
LL | memchr(std::ptr::null(), 0, 0);
|
||||||
| ^^^^^^^^^^ scalar size mismatch: expected 4 bytes but got 2 bytes instead
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ scalar size mismatch: expected 4 bytes but got 1 bytes instead
|
||||||
|
|
|
|
||||||
= help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior
|
= help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior
|
||||||
= help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information
|
= help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information
|
||||||
= note: backtrace:
|
= note: BACKTRACE:
|
||||||
= note: inside `main` at $DIR/shim_arg_size.rs:LL:CC
|
= note: inside `main` at $DIR/shim_arg_size.rs:LL:CC
|
||||||
|
|
||||||
note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace
|
note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace
|
Loading…
x
Reference in New Issue
Block a user