2004-06-27 <david@streamline-computing.com>
Partial fix for PR cli/1056. * valarith.c (value_binop): Check for zero in division and remainder evaluation.
This commit is contained in:
parent
a53b85e216
commit
399cfac618
2 changed files with 14 additions and 2 deletions
|
@ -1,3 +1,9 @@
|
|||
2004-06-27 <david@streamline-computing.com>
|
||||
|
||||
Partial fix for PR cli/1056.
|
||||
* valarith.c: Check for zero in division and remainder
|
||||
evaluation.
|
||||
|
||||
2004-06-27 Mark Kettenis <kettenis@gnu.org>
|
||||
|
||||
* i387-tdep.c: Remove excessive whitespace.
|
||||
|
|
|
@ -1040,7 +1040,10 @@ value_binop (struct value *arg1, struct value *arg2, enum exp_opcode op)
|
|||
break;
|
||||
|
||||
case BINOP_DIV:
|
||||
v = v1 / v2;
|
||||
if (v2 != 0)
|
||||
v = v1 / v2;
|
||||
else
|
||||
error ("Division by zero");
|
||||
break;
|
||||
|
||||
case BINOP_EXP:
|
||||
|
@ -1050,7 +1053,10 @@ value_binop (struct value *arg1, struct value *arg2, enum exp_opcode op)
|
|||
break;
|
||||
|
||||
case BINOP_REM:
|
||||
v = v1 % v2;
|
||||
if (v2 != 0)
|
||||
v = v1 % v2;
|
||||
else
|
||||
error ("Division by zero");
|
||||
break;
|
||||
|
||||
case BINOP_MOD:
|
||||
|
|
Loading…
Reference in a new issue