* valarith.c (value_binop): Handle unsigned BINOP_REM division by zero.
authorDoug Evans <dje@google.com>
Sun, 3 Feb 2008 01:51:04 +0000 (01:51 +0000)
committerDoug Evans <dje@google.com>
Sun, 3 Feb 2008 01:51:04 +0000 (01:51 +0000)
gdb/ChangeLog
gdb/valarith.c

index 7f90ef2e0efde625e8b66a90ffcded9fb8674ddc..a05058c18335a65b694e9f263af9a9ac8b442626 100644 (file)
@@ -1,5 +1,7 @@
 2008-02-02  Doug Evans  <dje@google.com>
 
+       * valarith.c (value_binop): Handle unsigned BINOP_REM division by zero.
+
        * typeprint.c (*): Whitespace cleanup.
 
 2008-02-02  Mark Kettenis  <kettenis@gnu.org>
index e69aaa67567d0925c2b50778746a94e65a2a1690..62059122c07f737c41f984872865db5a01519bc9 100644 (file)
@@ -1116,7 +1116,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: