add test for simd division overflow UB
This commit is contained in:
parent
d7c7fc0fa2
commit
c0f7251055
1 changed files with 15 additions and 0 deletions
15
tests/compile-fail/intrinsics/simd-div-overflow.rs
Normal file
15
tests/compile-fail/intrinsics/simd-div-overflow.rs
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
#![feature(platform_intrinsics, repr_simd)]
|
||||
|
||||
extern "platform-intrinsic" {
|
||||
pub(crate) fn simd_div<T>(x: T, y: T) -> T;
|
||||
}
|
||||
|
||||
#[repr(simd)]
|
||||
#[allow(non_camel_case_types)]
|
||||
struct i32x2(i32, i32);
|
||||
|
||||
fn main() { unsafe {
|
||||
let x = i32x2(1, i32::MIN);
|
||||
let y = i32x2(1, -1);
|
||||
simd_div(x, y); //~ERROR Undefined Behavior: overflow in signed division
|
||||
} }
|
||||
Loading…
Add table
Add a link
Reference in a new issue