From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 10478 invoked by alias); 23 Jan 2008 23:00:01 -0000 Received: (qmail 10467 invoked by uid 22791); 23 Jan 2008 23:00:01 -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:59:41 +0000 Received: from ICSMULLER (unknown [130.79.244.147]) by ics.u-strasbg.fr (Postfix) with ESMTP id D71F018701B; Thu, 24 Jan 2008 00:06:04 +0100 (CET) From: "Pierre Muller" To: Cc: "'Eli Zaretskii'" , References: <002d01c85849$ef420f80$cdc62e80$@u-strasbg.fr> <002401c85c1a$b1997b30$14cc7190$@u-strasbg.fr> In-Reply-To: Subject: RE: [RFA] Handle BINOP_INTDIV in valarith.c Date: Wed, 23 Jan 2008 23:00:00 -0000 Message-ID: <001c01c85e13$a123d9d0$e36b8d70$@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/msg00569.txt.bz2 > -----Original Message----- > From: gdb-patches-owner@sourceware.org [mailto:gdb-patches- > owner@sourceware.org] On Behalf Of Tom Tromey > Sent: Wednesday, January 23, 2008 7:30 PM > To: Pierre Muller > Cc: 'Eli Zaretskii'; gdb-patches@sourceware.org > Subject: Re: [RFA] Handle BINOP_INTDIV in valarith.c > > >>>>> "Pierre" == Pierre Muller writes: > > Pierre> This is the right thing to do for pascal, > Pierre> but I don't know about the other languages: > Pierre> do fortran, Ada, Modula-2 or java > Pierre> allow 'a / b' for a or b of integer types? > > For Java the normal binary promotion rules apply to '/'. > > That is: if either a or b is double, the other is promoted to double. > Then likewise for float. Currently gdb does promotion to doubles if one of the two is TYPE_CODE_FLT (i.e. any type of floating point, except maybe the decimal floating that was recently introduced and which code I did not look into yet). > Then likewise for long. > And finally, if none of those apply, both are promoted to int. > > So IOW, yes :) But this means that like C and unlike pascal '35 / 2' returns a integer of value 17, while for pascal it does return a real of value 17.5. > There are also special rules about certain integer divisions. > Division by zero throws an exception, and MIN_INT/-1 is defined to be > MIN_INT. You probably ment MAX_INT here, no? > In Java 5 there is also unboxing, but we never updated gdb to know > about that. I almost never used Java, so I have no idea what unboxing means... Pierre Muller