Skip to content

Commit cf269b9

Browse files
committed
actually check if lhs == MIN in div/rem overflow guards
1 parent 0e98bf1 commit cf269b9

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

crates/core_simd/tests/ops_impl/int_macros.rs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -253,6 +253,14 @@ macro_rules! int_tests {
253253
let _ = a / b;
254254
}
255255

256+
#[test]
257+
#[cfg_attr(target_arch = "wasm32", wasm_bindgen_test)]
258+
fn div_min_neg_one_no_panic() {
259+
let a = from_slice(&A);
260+
let b = from_slice(&vec![-1; 64]);
261+
let _ = a / b;
262+
}
263+
256264
#[test]
257265
#[cfg_attr(target_arch = "wasm32", wasm_bindgen_test)]
258266
fn rem() {
@@ -300,6 +308,14 @@ macro_rules! int_tests {
300308
assert_biteq!(a, expected);
301309
}
302310

311+
#[test]
312+
#[cfg_attr(target_arch = "wasm32", wasm_bindgen_test)]
313+
fn rem_min_neg_one_no_panic() {
314+
let a = from_slice(&A);
315+
let b = from_slice(&vec![-1; 64]);
316+
let _ = a % b;
317+
}
318+
303319
#[test]
304320
#[should_panic]
305321
fn rem_min_panic() {

0 commit comments

Comments
 (0)