Fix PR43730: ICE in builtins.c

Richard Guenther richard.guenther@gmail.com
Tue Apr 13 12:47:00 GMT 2010


On Tue, Apr 13, 2010 at 2:36 PM, Michael Matz <matz@suse.de> wrote:
> Hello,
>
> we can't just blindly assert that 'target' will match the predicate, we
> have to do something if it doesn't.
>
> Regstrapping on x86-64-linux in progress (all langs+Ada).  Okay for trunk?
> What about 4.5?

Ok for trunk and 4.5.

Thanks,
Richard.

>
> Ciao,
> Michael.
> --
>        PR middle-end/43730
>        * builtins.c (expand_builtin_interclass_mathfn): Also create
>        a register if the predicate doesn't match.
>
> testsuite/
>        * gcc.dg/pr43730.c: New test.
>
> Index: builtins.c
> ===================================================================
> --- builtins.c  (revision 158263)
> +++ builtins.c  (working copy)
> @@ -2316,7 +2316,8 @@ expand_builtin_interclass_mathfn (tree e
>       tree orig_arg = arg;
>       /* Make a suitable register to place result in.  */
>       if (!target
> -         || GET_MODE (target) != TYPE_MODE (TREE_TYPE (exp)))
> +         || GET_MODE (target) != TYPE_MODE (TREE_TYPE (exp))
> +         || !insn_data[icode].operand[0].predicate (target, GET_MODE (target)))
>          target = gen_reg_rtx (TYPE_MODE (TREE_TYPE (exp)));
>
>       gcc_assert (insn_data[icode].operand[0].predicate
> Index: testsuite/gcc.dg/pr43730.c
> ===================================================================
> --- testsuite/gcc.dg/pr43730.c  (revision 0)
> +++ testsuite/gcc.dg/pr43730.c  (revision 0)
> @@ -0,0 +1,19 @@
> +/* { dg-do compile } */
> +/* { dg-options "-O0" } */
> +extern int (isinfl)(long double);
> +
> +int
> +bugfun(long double x, long double y)
> +{
> +  int result;
> +
> +  if (isinfl(x))
> +    result = isinfl(y);
> +  else
> +    {
> +      int kx, ky;
> +      kx = ky = 1;
> +      result = (kx == ky);
> +    }
> +  return (result);
> +}
>



More information about the Gcc-patches mailing list