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

janus at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
           Assignee|unassigned at gcc dot gnu.org      |janus at gcc dot gnu.org

--- Comment #3 from janus at gcc dot gnu.org ---
The ICE (and another one that is triggered by the same test case) is fixed with
this patch:


diff --git a/gcc/fortran/match.c b/gcc/fortran/match.c
index 85247dd8334..6cf816be511 100644
--- a/gcc/fortran/match.c
+++ b/gcc/fortran/match.c
@@ -6009,7 +6009,7 @@ copy_ts_from_selector_to_associate (gfc_expr *associate,
gfc_expr *selector)
   else
     assoc_sym->as = NULL;

-  if (selector->ts.type == BT_CLASS)
+  if (selector->ts.type == BT_CLASS && gfc_expr_attr (selector).class_ok)
     {
       /* The correct class container has to be available.  */
       assoc_sym->ts.type = BT_CLASS;
diff --git a/gcc/fortran/resolve.c b/gcc/fortran/resolve.c
index ea0ce800743..97f5402bf29 100644
--- a/gcc/fortran/resolve.c
+++ b/gcc/fortran/resolve.c
@@ -8862,7 +8862,8 @@ resolve_select_type (gfc_code *code, gfc_namespace
*old_ns)
       return;
     }

-  if (!code->expr1->symtree->n.sym->attr.class_ok)
+  if (!code->expr1->symtree->n.sym->attr.class_ok
+      || !gfc_expr_attr (code->expr2).class_ok)
     return;

   if (code->expr2)

Reply via email to