| Index: src/mips/simulator-mips.cc
|
| diff --git a/src/mips/simulator-mips.cc b/src/mips/simulator-mips.cc
|
| index cf87f93602e51d55d27873e6843b7e63c5a1d6cb..cb5647332a2cee6336c47411a21c7944e94cebe5 100644
|
| --- a/src/mips/simulator-mips.cc
|
| +++ b/src/mips/simulator-mips.cc
|
| @@ -2219,10 +2219,10 @@ void Simulator::DecodeTypeRegister(Instruction* instr) {
|
| set_register(HI, static_cast<int32_t>(u64hilo >> 32));
|
| break;
|
| case DIV:
|
| - // Divide by zero was not checked in the configuration step - div and
|
| - // divu do not raise exceptions. On division by 0, the result will
|
| - // be UNPREDICTABLE.
|
| - if (rt != 0) {
|
| + // Divide by zero and overflow was not checked in the configuration
|
| + // step - div and divu do not raise exceptions. On division by 0 and
|
| + // on overflow (INT_MIN/-1), the result will be UNPREDICTABLE.
|
| + if (rt != 0 && !(rs == INT_MIN && rt == -1)) {
|
| set_register(LO, rs / rt);
|
| set_register(HI, rs % rt);
|
| }
|
|
|