From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 21275 invoked by alias); 16 Jan 2008 14:14:05 -0000 Received: (qmail 21264 invoked by uid 22791); 16 Jan 2008 14:14:05 -0000 X-Spam-Check-By: sourceware.org Received: from ics.u-strasbg.fr (HELO ics.u-strasbg.fr) (130.79.112.250) by sourceware.org (qpsmtpd/0.31) with ESMTP; Wed, 16 Jan 2008 14:13:18 +0000 Received: from ICSMULLER (laocoon.u-strasbg.fr [130.79.112.72]) by ics.u-strasbg.fr (Postfix) with ESMTP id D2A4D18701A for ; Wed, 16 Jan 2008 15:16:58 +0100 (CET) From: "Pierre Muller" To: Subject: [RFA] Handle BINOP_INTDIV in valarith.c Date: Wed, 16 Jan 2008 14:14:00 -0000 Message-ID: <002d01c85849$ef420f80$cdc62e80$@u-strasbg.fr> MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit X-Mailer: Microsoft Office Outlook 12.0 Content-Language: en-us Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2008-01/txt/msg00403.txt.bz2 While trying to write a pascal expression parser test I came upon the problem that BINOP_INTDIV is not handled in value_binop function. (gdb) set lang pascal (gdb) print 25 div 2 GDB does not (yet) know how to evaluate that kind of expression This patch fixes this. OK to commit? Pierre Muller I also noticed that the unsigned case is not guarded against v2 being zero, but I will send another patch for this once that one is in. ChangeLog entry: 2008-01-16 Pierre Muller * valarith.c (value_binop): Handle BINOP_INTDIV for unsigned and signed integers. Index: gdb/valarith.c =================================================================== RCS file: /cvs/src/src/gdb/valarith.c,v retrieving revision 1.52 diff -u -p -r1.52 valarith.c --- gdb/valarith.c 7 Jan 2008 22:33:57 -0000 1.52 +++ gdb/valarith.c 16 Jan 2008 14:09:44 -0000 @@ -1033,6 +1033,7 @@ value_binop (struct value *arg1, struct break; case BINOP_DIV: + case BINOP_INTDIV: v = v1 / v2; break; @@ -1152,6 +1153,7 @@ value_binop (struct value *arg1, struct break; case BINOP_DIV: + case BINOP_INTDIV: if (v2 != 0) v = v1 / v2; else