summaryrefslogtreecommitdiffstats
path: root/gdb
diff options
context:
space:
mode:
authorDavid Lecomber <david@lecomber.net>2004-06-27 07:57:15 +0000
committerDavid Lecomber <david@lecomber.net>2004-06-27 07:57:15 +0000
commit399cfac618149ed1325b5fea3cdff8c3e50fe7dc (patch)
tree62cec1ba3f6d78e094be9d1032326b207fd1b6b8 /gdb
parenta53b85e216049b3cb9b26c5a78ef437115183225 (diff)
downloadppe42-binutils-399cfac618149ed1325b5fea3cdff8c3e50fe7dc.tar.gz
ppe42-binutils-399cfac618149ed1325b5fea3cdff8c3e50fe7dc.zip
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.
Diffstat (limited to 'gdb')
-rw-r--r--gdb/ChangeLog6
-rw-r--r--gdb/valarith.c10
2 files changed, 14 insertions, 2 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 989cf2c1c3..5b86c07437 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -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.
diff --git a/gdb/valarith.c b/gdb/valarith.c
index 1a86e921f4..7858f91d0d 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:
OpenPOWER on IntegriCloud