This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[RFA] handle value_binop BINOP_REM division by zero
- From: "Doug Evans" <dje at google dot com>
- To: "GDB Patches" <gdb-patches at sourceware dot org>
- Date: Wed, 30 Jan 2008 08:44:35 -0800
- Subject: [RFA] handle value_binop BINOP_REM division by zero
Unsigned division by zero got patched but not BINOP_REM.
Ok to check in?
2008-01-30 Doug Evans <dje@google.com>
* valarith.c (value_binop): Handle BINOP_REM division by zero.
Index: valarith.c
===================================================================
RCS file: /cvs/src/src/gdb/valarith.c,v
retrieving revision 1.56
diff -u -p -r1.56 valarith.c
--- valarith.c 30 Jan 2008 07:28:16 -0000 1.56
+++ valarith.c 30 Jan 2008 16:40:26 -0000
@@ -1116,7 +1116,10 @@ value_binop (struct value *arg1, struct
break;
case BINOP_REM:
- v = v1 % v2;
+ if (v2 !=0)
+ v = v1 % v2;
+ else
+ error (_("Division by zero"));
break;
case BINOP_MOD: