This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: PATCH: PR middle-end/33007: builtin lround doesn't work


On Mon, Aug 20, 2007 at 10:32:24AM +0200, Richard Guenther wrote:
> On 8/7/07, H.J. Lu <hjl@lucon.org> 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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]