aboutsummaryrefslogtreecommitdiff
path: root/gdb/valarith.c
diff options
context:
space:
mode:
authorPierre Muller <muller@sourceware.org>2008-01-29 14:24:43 +0000
committerPierre Muller <muller@sourceware.org>2008-01-29 14:24:43 +0000
commitc3940723cfe1cddb8d348e98e1a47f99d20389e8 (patch)
treed3e79d42bb7ee0b4c68766e6be32d924e42d0b9f /gdb/valarith.c
parent930bb4cfae30f3816321b8843b87fab945c57515 (diff)
downloadgdb-c3940723cfe1cddb8d348e98e1a47f99d20389e8.zip
gdb-c3940723cfe1cddb8d348e98e1a47f99d20389e8.tar.gz
gdb-c3940723cfe1cddb8d348e98e1a47f99d20389e8.tar.bz2
* valarith.c (value_binop): Handle unsigned integer
division by zero.
Diffstat (limited to 'gdb/valarith.c')
-rw-r--r--gdb/valarith.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/gdb/valarith.c b/gdb/valarith.c
index 173c7a5..2fa435d 100644
--- a/gdb/valarith.c
+++ b/gdb/valarith.c
@@ -1035,7 +1035,10 @@ value_binop (struct value *arg1, struct value *arg2, enum exp_opcode op)
case BINOP_DIV:
case BINOP_INTDIV:
- v = v1 / v2;
+ if (v2 != 0)
+ v = v1 / v2;
+ else
+ error (_("Division by zero"));
break;
case BINOP_EXP: