aboutsummaryrefslogtreecommitdiff
path: root/gdb/valarith.c
diff options
context:
space:
mode:
Diffstat (limited to 'gdb/valarith.c')
-rw-r--r--gdb/valarith.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/gdb/valarith.c b/gdb/valarith.c
index 1a86e92..7858f91 100644
--- a/gdb/valarith.c
+++ b/gdb/valarith.c
@@ -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: