From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 13971 invoked by alias); 21 Aug 2007 18:53:47 -0000 Received: (qmail 13933 invoked by uid 22791); 21 Aug 2007 18:53:47 -0000 X-Spam-Check-By: sourceware.org Received: from rwcrmhc15.comcast.net (HELO rwcrmhc15.comcast.net) (216.148.227.155) by sourceware.org (qpsmtpd/0.31) with ESMTP; Tue, 21 Aug 2007 18:53:41 +0000 Received: from lucon.org ([24.6.230.138]) by comcast.net (rwcrmhc15) with ESMTP id <20070821185339m150000kbhe>; Tue, 21 Aug 2007 18:53:40 +0000 Received: by lucon.org (Postfix, from userid 500) id A7D41F81E8; Tue, 21 Aug 2007 11:53:39 -0700 (PDT) Date: Tue, 21 Aug 2007 18:54:00 -0000 From: "H.J. Lu" To: Richard Guenther Cc: gcc-patches@gcc.gnu.org, ghazi@caip.rutgers.edu Subject: Re: PATCH: PR middle-end/33007: builtin lround doesn't work Message-ID: <20070821185339.GA27035@lucon.org> References: <20070807180243.GA15223@lucon.org> <84fc9c000708200132p2dbd73c7xbbb4120dada4e800@mail.gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <84fc9c000708200132p2dbd73c7xbbb4120dada4e800@mail.gmail.com> User-Agent: Mutt/1.5.14 (2007-02-12) X-IsSubscribed: yes Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org X-SW-Source: 2007-08/txt/msg01384.txt.bz2 On Mon, Aug 20, 2007 at 10:32:24AM +0200, Richard Guenther wrote: > On 8/7/07, H.J. Lu wrote: > > fold_fixed_mathfn may turn builtin lround into FIX_TRUNC_EXPR. But > > expand_builtin_int_roundingfn_2 isn't prepared to deal with it. This > > patch checks return from expand_expr and handle FIX_TRUNC_EXPR. > > > > This is not the right way to fix this really. Instead this is the > common problem > that build_call_expr folds the built expression. Instead for > > /* Wrap the computation of the argument in a SAVE_EXPR, as we may > need to expand the argument again. This way, we will not perform > side-effects more the once. */ > narg = builtin_save_expr (arg); > if (narg != arg) > { > arg = narg; > exp = build_call_expr (fndecl, 1, arg); > } > > we should re-build the call expression _without_ folding it. (Or > rather we can fix > the place that created the call without folding it - that is, fold > during TER). See > for example expand_builtin_cexpi or others which make sure not to re-fold the > call expression. > I am not familiar with middle end. Can some middle-end people look into it? Thanks. H.J.