@@ -177,8 +177,8 @@ impl<'mir, 'tcx, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
177
177
return Ok ( ( Scalar :: from_bool ( op ( & l, & r) ) , false , self . tcx . types . bool ) ) ;
178
178
}
179
179
let op: Option < fn ( i128 , i128 ) -> ( i128 , bool ) > = match bin_op {
180
- Div if r == 0 => throw_panic ! ( DivisionByZero ) ,
181
- Rem if r == 0 => throw_panic ! ( RemainderByZero ) ,
180
+ Div if r == 0 => throw_ub ! ( DivisionByZero ) ,
181
+ Rem if r == 0 => throw_ub ! ( RemainderByZero ) ,
182
182
Div => Some ( i128:: overflowing_div) ,
183
183
Rem => Some ( i128:: overflowing_rem) ,
184
184
Add => Some ( i128:: overflowing_add) ,
@@ -234,8 +234,8 @@ impl<'mir, 'tcx, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
234
234
Add => u128:: overflowing_add,
235
235
Sub => u128:: overflowing_sub,
236
236
Mul => u128:: overflowing_mul,
237
- Div if r == 0 => throw_panic ! ( DivisionByZero ) ,
238
- Rem if r == 0 => throw_panic ! ( RemainderByZero ) ,
237
+ Div if r == 0 => throw_ub ! ( DivisionByZero ) ,
238
+ Rem if r == 0 => throw_ub ! ( RemainderByZero ) ,
239
239
Div => u128:: overflowing_div,
240
240
Rem => u128:: overflowing_rem,
241
241
_ => bug ! ( ) ,
0 commit comments