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

Tobias Burnus <burnus at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2019-11-27
                 CC|                            |burnus at gcc dot gnu.org,
                   |                            |pault at gcc dot gnu.org
     Ever confirmed|0                           |1

--- Comment #1 from Tobias Burnus <burnus at gcc dot gnu.org> ---
No regression as 'select rank' is new.

In gfc_check_vardef_context, assoc->variable == NULL and
assoc->target == NULL  [this one causes the segfault] and
assoc->st->name == "__tmp_class___class_a_R_15_0t_rank_1"

On the other hand, e->symtree->n.sym->assoc->target exists and
e->symtree->n.sym->assoc->target->symtree == assoc->st.

assoc gets set (ll. 6213–6219) as:
          gfc_expr* t = sym->assoc->target;
          gcc_assert (t->expr_type == EXPR_VARIABLE);
          name = t->symtree->name;
          if (t->symtree->n.sym->assoc)
            assoc = t->symtree->n.sym->assoc;
          else
            assoc = sym->assoc;
That's sufficient for:
      gcc_assert (name && assoc);
But then it fails when doing:
      assoc->target->expr_type
(That's for !assoc->variable – but also the else branch assumes that
assoc->target != NULL.)

Reply via email to