Skip to content

Commit c0f7251

Browse files
committed
add test for simd division overflow UB
1 parent d7c7fc0 commit c0f7251

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#![feature(platform_intrinsics, repr_simd)]
2+
3+
extern "platform-intrinsic" {
4+
pub(crate) fn simd_div<T>(x: T, y: T) -> T;
5+
}
6+
7+
#[repr(simd)]
8+
#[allow(non_camel_case_types)]
9+
struct i32x2(i32, i32);
10+
11+
fn main() { unsafe {
12+
let x = i32x2(1, i32::MIN);
13+
let y = i32x2(1, -1);
14+
simd_div(x, y); //~ERROR Undefined Behavior: overflow in signed division
15+
} }

0 commit comments

Comments
 (0)