From c3940723cfe1cddb8d348e98e1a47f99d20389e8 Mon Sep 17 00:00:00 2001 From: Pierre Muller Date: Tue, 29 Jan 2008 14:24:43 +0000 Subject: [PATCH] * valarith.c (value_binop): Handle unsigned integer division by zero. --- gdb/ChangeLog | 5 +++++ gdb/valarith.c | 5 ++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 2e594f24caf..cc27fa9fb6d 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,8 @@ +2008-01-29 Pierre Muller + + * valarith.c (value_binop): Handle unsigned integer + division by zero. + 2008-01-28 Kevin Buettner * mn10300-tdep.c (mn10300_analyze_prologue): Check for an diff --git a/gdb/valarith.c b/gdb/valarith.c index 173c7a5dbb1..2fa435d446d 100644 --- a/gdb/valarith.c +++ b/gdb/valarith.c @@ -1035,7 +1035,10 @@ value_binop (struct value *arg1, struct value *arg2, enum exp_opcode op) case BINOP_DIV: case BINOP_INTDIV: - v = v1 / v2; + if (v2 != 0) + v = v1 / v2; + else + error (_("Division by zero")); break; case BINOP_EXP: -- 2.30.2