Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [RFA] handle value_binop BINOP_REM division by zero
@ 2008-01-30 16:53 Doug Evans
  2008-01-30 17:18 ` Daniel Jacobowitz
  0 siblings, 1 reply; 3+ messages in thread
From: Doug Evans @ 2008-01-30 16:53 UTC (permalink / raw)
  To: GDB Patches

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:


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2008-01-30 17:18 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-01-30 16:53 [RFA] handle value_binop BINOP_REM division by zero Doug Evans
2008-01-30 17:18 ` Daniel Jacobowitz
2008-01-30 17:46   ` Doug Evans

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox