[Patch, fortran] PR31217 - ICE using FORALL on character substrings

Dominique Dhumieres dominiq@lps.ens.fr
Sat Oct 27 19:54:00 GMT 2007


Copy of the change in the patch Paul has sent me in a private mail:

This was the one that worked:

static int
check_forall_dependencies (gfc_code *c, stmtblock_t *pre, stmtblock_t *post)
{
  gfc_ref *lref;
  gfc_ref *rref;
  int need_temp;
  gfc_symbol *lsym;

  lsym = c->expr->symtree->n.sym;
  need_temp = gfc_check_dependency (c->expr, c->expr2, 0);

  /* Now check for dependencies within the 'variable'
     expression itself.  These are treated by making a complete
     copy of variable and changing all the references to it
     point to the copy instead.  Note that the shallow copy of
     the variable will not suffice for derived types with
     pointer components.  We therefore leave these to their
     own devices.  */
  if (lsym->ts.type == BT_DERIVED
        && lsym->ts.derived->attr.pointer_comp)
    return need_temp;

  new_symtree = NULL;
  if (find_forall_index (c->expr, lsym, 2) == SUCCESS)
    {
      forall_make_variable_temp (c, pre, post);
      need_temp = 0;
    }

etc. etc...

With it the regression disappears and the patch works as expected.

Dominique



More information about the Fortran mailing list