On Thu, Jun 23, 2016 at 1:14 PM, Eric Botcazou <ebotca...@adacore.com> wrote:
>> The gimplifier has been changed recently to use anonymous SSA_NAMEs instead
>> of temporary decls.
>
> But the PR is a regression present since GCC 4.7...
>
>> And the gimplifier uses save_expr (which is a gimplifier function BTW) on
>> both not gimplified at all as well as partially gimplified trees.
>
> Are you confounding it with something else?  Because save_expr is definitely
> not a gimplifier function, it's mostly used to build GENERIC trees.  That
> being said, I can imagine it being invoked from the gimplifier, but I'd like
> to see the backtrace.

So the issue is that the inliner uses fold_convert:

  if (value
      && value != error_mark_node
      && !useless_type_conversion_p (TREE_TYPE (p), TREE_TYPE (value)))
    {
      /* If we can match up types by promotion/demotion do so.  */
      if (fold_convertible_p (TREE_TYPE (p), value))
        rhs = fold_convert (TREE_TYPE (p), value);
      else

and converting a _Complex double to a _Complex long double.  That
generates

COMPLEX_EXPR <(long double) REALPART_EXPR <SAVE_EXPR <a.0_1>>, (long
double) IMAGPART_EXPR <SAVE_EXPR <a.0_1>>>

which in insert_init_stmt we insert into the IL w/o gimplifying it
(thus the operand
scanner ICEs).

IMHO using fold-convert in this case is bogus and ideally the testcase
should have been diagnosed.

fold_convertible_p has a comment

/* Returns true, if ARG is convertible to TYPE using a NOP_EXPR.  *

but clearly it isn't generating just a NOP_EXPR (or VIEW_CONVERT_EXPR
or other single operation) here.

So that is the thing to fix.  The way we build / insert the init stmts
can also be improved by properly
gimplifying the rhs first but of course that likely runs into the
SAVE_EXPR case you mentioned.

Richard.

> --
> Eric Botcazou

Reply via email to