https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88117

--- Comment #6 from Thomas Koenig <tkoenig at gcc dot gnu.org> ---
(In reply to Thomas Koenig from comment #5)
> Rather, the problem seems to be somewhere in trans-expr.c:
> 
>       if (expr1->ts.deferred && gfc_check_dependency (expr1, expr2, true))
>       rse.string_length = gfc_evaluate_now (rse.string_length, &rse.pre);
> 
> 
> The variable created by gfc_evaluate_now here is D.3908, the culprit
> for gimplification in the simplified test case.  Hmm...

Actually, not here.

It is

  /* Stabilize a string length for temporaries.  */
  if (expr2->ts.type == BT_CHARACTER && !expr1->ts.deferred
      && !(VAR_P (rse.string_length)
           || TREE_CODE (rse.string_length) == PARM_DECL
           || TREE_CODE (rse.string_length) == INDIRECT_REF))
    string_length = gfc_evaluate_now (rse.string_length, &rse.pre);

where string_length seems to be added to the wrong scope - it is
used before it is defined, which causes the gimplification error.

Now, I'm not sure how to change that, at least not tonight.

Reply via email to