expand_builtin_mathfn_2 fix

Richard Guenther richard.guenther@gmail.com
Thu Jul 17 12:30:00 GMT 2008


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?

I wonder if we shouldn't just pass NULL all the time here (shouldn't
subtarget be always a suitable target mode?)

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 ();
>



More information about the Gcc-patches mailing list