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

* Re: [RFA] handle value_binop BINOP_REM division by zero
  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
  0 siblings, 1 reply; 3+ messages in thread
From: Daniel Jacobowitz @ 2008-01-30 17:18 UTC (permalink / raw)
  To: Doug Evans; +Cc: GDB Patches

On Wed, Jan 30, 2008 at 08:44:35AM -0800, Doug Evans wrote:
> 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.

OK.
> +             if (v2 !=0)

"!= 0"


-- 
Daniel Jacobowitz
CodeSourcery


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

* Re: [RFA] handle value_binop BINOP_REM division by zero
  2008-01-30 17:18 ` Daniel Jacobowitz
@ 2008-01-30 17:46   ` Doug Evans
  0 siblings, 0 replies; 3+ messages in thread
From: Doug Evans @ 2008-01-30 17:46 UTC (permalink / raw)
  To: GDB Patches

On Jan 30, 2008 8:51 AM, Daniel Jacobowitz <drow@false.org> wrote:
> > +             if (v2 !=0)
>
> "!= 0"

Ya, I was going to send an immediate follow-up, but this list gets
enough traffic.

Thanks.  [And if I don't say thanks for every "OK" it's only because
I'm trying to maintain the signal/noise ratio.]


^ 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