This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: expand_builtin_mathfn_2 fix
> On Thu, Jul 17, 2008 at 1:16 PM, Jan Hubicka <jh@suse.cz> wrote:
> >
> > Hi,
> > with SSA at -O0 we fail to compile gfortran.dg/g77/20010430.f
> > because expression __builtin_lroundf (f+<someconstant>) fails to compile. This is because
> > __builtin_lroundf is passed DImode subtarget and it attempts to use it as temporary for
> > the floating point f+<someconstant> expression.
> >
> > Bootstrapped/regtested i686-linux, OK?
> >
> > * builtins.c (expand_builtin_mathfn_2): Check mode of subtarget.
>
> It's expand_builtin_int_roundingfn_2 actually, and
> expand_builtin_int_roundingfn should have the same problem, no?
Probably.
>
> I wonder if we shouldn't just pass NULL all the time here (shouldn't
> subtarget be always a suitable target mode?)
I don't know. Expr.c always builds subtarget in the destination mode.
I guess it is bit hard to do what mode subtarget will be needed
beforehand, but I am not expert here.
Honza
>
> Richard.
>
> > Index: builtins.c
> > ===================================================================
> > --- builtins.c (revision 137842)
> > +++ builtins.c (working copy)
> > @@ -2635,6 +2635,11 @@
> > side-effects more the once. */
> > CALL_EXPR_ARG (exp, 0) = arg = builtin_save_expr (arg);
> >
> > + /* Conversion operations needs subtarget of different type. We are safe
> > + to ignore it. */
> > + if (subtarget && GET_MODE (subtarget) != TYPE_MODE (TREE_TYPE (arg)))
> > + subtarget = NULL;
> > +
> > op0 = expand_expr (arg, subtarget, VOIDmode, EXPAND_NORMAL);
> >
> > start_sequence ();
> >