organize failing ABI compat tests and add some more

This commit is contained in:
Ralf Jung 2023-08-30 08:43:20 +02:00
parent 1e95aa0c49
commit c1a34729e1
14 changed files with 58 additions and 10 deletions

View File

@ -0,0 +1,7 @@
fn main() {
fn f(_: f32) {}
let g = unsafe { std::mem::transmute::<fn(f32), fn(i32)>(f) };
g(42) //~ ERROR: calling a function with argument of type f32 passing data of type i32
}

View File

@ -0,0 +1,15 @@
error: Undefined Behavior: calling a function with argument of type f32 passing data of type i32
--> $DIR/abi_mismatch_int_vs_float.rs:LL:CC
|
LL | g(42)
| ^^^^^ calling a function with argument of type f32 passing data of type i32
|
= 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/abi_mismatch_int_vs_float.rs:LL:CC
note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace
error: aborting due to previous error

View File

@ -1,5 +1,5 @@
error: Undefined Behavior: calling a function with argument of type *const [i32] passing data of type *const i32
--> $DIR/cast_fn_ptr4.rs:LL:CC
--> $DIR/abi_mismatch_raw_pointer.rs:LL:CC
|
LL | g(&42 as *const i32)
| ^^^^^^^^^^^^^^^^^^^^ calling a function with argument of type *const [i32] passing data of type *const i32
@ -7,7 +7,7 @@ LL | g(&42 as *const i32)
= 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/cast_fn_ptr4.rs:LL:CC
= note: inside `main` at $DIR/abi_mismatch_raw_pointer.rs:LL:CC
note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace

View File

@ -1,5 +1,5 @@
error: Undefined Behavior: calling a function with return type u32 passing return place of type ()
--> $DIR/cast_fn_ptr5.rs:LL:CC
--> $DIR/abi_mismatch_return_type.rs:LL:CC
|
LL | g()
| ^^^ calling a function with return type u32 passing return place of type ()
@ -7,7 +7,7 @@ LL | g()
= 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/cast_fn_ptr5.rs:LL:CC
= note: inside `main` at $DIR/abi_mismatch_return_type.rs:LL:CC
note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace

View File

@ -1,5 +1,5 @@
error: Undefined Behavior: calling a function with argument of type (i32, i32) passing data of type i32
--> $DIR/cast_fn_ptr2.rs:LL:CC
--> $DIR/abi_mismatch_simple.rs:LL:CC
|
LL | g(42)
| ^^^^^ calling a function with argument of type (i32, i32) passing data of type i32
@ -7,7 +7,7 @@ LL | g(42)
= 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/cast_fn_ptr2.rs:LL:CC
= note: inside `main` at $DIR/abi_mismatch_simple.rs:LL:CC
note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace

View File

@ -1,5 +1,5 @@
error: Undefined Behavior: calling a function with fewer arguments than it requires
--> $DIR/cast_fn_ptr3.rs:LL:CC
--> $DIR/abi_mismatch_too_few_args.rs:LL:CC
|
LL | g()
| ^^^ calling a function with fewer arguments than it requires
@ -7,7 +7,7 @@ LL | g()
= 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/cast_fn_ptr3.rs:LL:CC
= note: inside `main` at $DIR/abi_mismatch_too_few_args.rs:LL:CC
note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace

View File

@ -1,5 +1,5 @@
error: Undefined Behavior: calling a function with more arguments than it expected
--> $DIR/cast_fn_ptr1.rs:LL:CC
--> $DIR/abi_mismatch_too_many_args.rs:LL:CC
|
LL | g(42)
| ^^^^^ calling a function with more arguments than it expected
@ -7,7 +7,7 @@ LL | g(42)
= 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/cast_fn_ptr1.rs:LL:CC
= note: inside `main` at $DIR/abi_mismatch_too_many_args.rs:LL:CC
note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace

View File

@ -0,0 +1,11 @@
#![feature(portable_simd)]
use std::simd;
fn main() {
fn f(_: simd::u32x8) {}
// These two vector types have the same size but are still not compatible.
let g = unsafe { std::mem::transmute::<fn(simd::u32x8), fn(simd::u64x4)>(f) };
g(Default::default()) //~ ERROR: calling a function with argument of type std::simd::Simd<u32, 8> passing data of type std::simd::Simd<u64, 4>
}

View File

@ -0,0 +1,15 @@
error: Undefined Behavior: calling a function with argument of type std::simd::Simd<u32, 8> passing data of type std::simd::Simd<u64, 4>
--> $DIR/abi_mismatch_vector.rs:LL:CC
|
LL | g(Default::default())
| ^^^^^^^^^^^^^^^^^^^^^ calling a function with argument of type std::simd::Simd<u32, 8> passing data of type std::simd::Simd<u64, 4>
|
= 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/abi_mismatch_vector.rs:LL:CC
note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace
error: aborting due to previous error