From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 27538 invoked by alias); 31 Jan 2008 22:27:04 -0000 Received: (qmail 27522 invoked by uid 22791); 31 Jan 2008 22:27:03 -0000 X-Spam-Check-By: sourceware.org Received: from NaN.false.org (HELO nan.false.org) (208.75.86.248) by sourceware.org (qpsmtpd/0.31) with ESMTP; Thu, 31 Jan 2008 22:26:43 +0000 Received: from nan.false.org (localhost [127.0.0.1]) by nan.false.org (Postfix) with ESMTP id 688DE98218; Thu, 31 Jan 2008 22:26:42 +0000 (GMT) Received: from caradoc.them.org (22.svnf5.xdsl.nauticom.net [209.195.183.55]) by nan.false.org (Postfix) with ESMTP id 4AF5098214; Thu, 31 Jan 2008 22:26:42 +0000 (GMT) Received: from drow by caradoc.them.org with local (Exim 4.68) (envelope-from ) id 1JKhrl-0001xf-80; Thu, 31 Jan 2008 17:26:41 -0500 Date: Thu, 31 Jan 2008 22:43:00 -0000 From: Daniel Jacobowitz To: Pierre Muller Cc: gdb-patches@sourceware.org Subject: Re: [Patch] p-exp.y: Typecast left operand of BINOP_DIV to long double Message-ID: <20080131222641.GD6715@caradoc.them.org> Mail-Followup-To: Pierre Muller , gdb-patches@sourceware.org References: <000c01c861c5$149352b0$3db9f810$@u-strasbg.fr> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <000c01c861c5$149352b0$3db9f810$@u-strasbg.fr> User-Agent: Mutt/1.5.17 (2007-12-11) X-IsSubscribed: yes 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/msg00880.txt.bz2 On Mon, Jan 28, 2008 at 04:47:26PM +0100, Pierre Muller wrote: > Could someone please confirm that the > way I inserted the implicit typecast in the parser is > correct? > All comments most welcome. It looks OK to me. Does the type of the left operand completely determine the type of the operation, or do you need to worry about the type of the right-hand exp too before you cast? > @@ -367,7 +370,15 @@ exp : exp '*' exp > { write_exp_elt_opcode (BINOP_MUL); } > ; > > -exp : exp '/' exp > +exp : exp '/' { > + if (current_type && is_integral_type > (current_type)) > + { > + write_exp_elt_opcode (UNOP_CAST); > + write_exp_elt_type (builtin_type_long_double); > + write_exp_elt_opcode (UNOP_CAST); > + } > + } > + exp > { write_exp_elt_opcode (BINOP_DIV); } > ; > Won't current_type still be integral after this? Try 1 / 2 / 3. -- Daniel Jacobowitz CodeSourcery