From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 29023 invoked by alias); 23 Jan 2008 22:36:06 -0000 Received: (qmail 29010 invoked by uid 22791); 23 Jan 2008 22:36:04 -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, 23 Jan 2008 22:35:45 +0000 Received: from ICSMULLER (unknown [130.79.244.147]) by ics.u-strasbg.fr (Postfix) with ESMTP id 064F518701B; Wed, 23 Jan 2008 23:42:07 +0100 (CET) From: "Pierre Muller" To: "'Joel Brobecker'" Cc: "'Eli Zaretskii'" , References: <002d01c85849$ef420f80$cdc62e80$@u-strasbg.fr> <002401c85c1a$b1997b30$14cc7190$@u-strasbg.fr> <20080123182514.GB3979@adacore.com> In-Reply-To: <20080123182514.GB3979@adacore.com> Subject: RE: [RFA] Handle BINOP_INTDIV in valarith.c Date: Wed, 23 Jan 2008 22:36:00 -0000 Message-ID: <001b01c85e10$48a8aa40$d9f9fec0$@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/msg00568.txt.bz2 > -----Original Message----- > From: Joel Brobecker [mailto:brobecker@adacore.com] > Sent: Wednesday, January 23, 2008 7:25 PM > To: Pierre Muller > Cc: 'Eli Zaretskii'; gdb-patches@sourceware.org > Subject: Re: [RFA] Handle BINOP_INTDIV in valarith.c > > > I will send a separate patch for > > a new binop called BINOP_FLOATDIV > > that will force the result of 'a / b' to be a > > float in all cases. > > That seems unnecessary to me unless BINOP_DIV and your BINOP_FLOATDIV > have different meanings in Pascal? Otherwise, I think the problem is > that the pascal language needs its own expression evaluator so that > it can handle the '/' operator specifically. The rest can be delegated > to the standard expression evaluator. I wrote the floatdiv version, which allows me to easily force the conversion to double formats for left and right operand: This simple patch portion from gdb/valarith.c does the main trick: @@ -865,7 +868,8 @@ value_binop (struct value *arg1, struct } else if (TYPE_CODE (type1) == TYPE_CODE_FLT || - TYPE_CODE (type2) == TYPE_CODE_FLT) + TYPE_CODE (type2) == TYPE_CODE_FLT + || op == BINOP_FLOATDIV) { /* FIXME-if-picky-about-floating-accuracy: Should be doing this in target format. real.c in GCC probably has the necessary Adding BINOP_FLOATDIV is indeed unnecessary if you can tell me how to check for the correct languages here. maybe || (op == BINOP_DIV && current_language = language_pascal)) would work, but I don't know if current_language is the right variable to test and it would make the use of this feature by other languages more complicated than just switching from BINOP_DIV vto BINOP_FLOATDIV in their respective expression parser? Pierre Muller GDB pascal language support maintainer