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

kargl at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P3                          |P4
     Ever confirmed|0                           |1
             Status|UNCONFIRMED                 |NEW
                 CC|                            |kargl at gcc dot gnu.org
   Last reconfirmed|                            |2022-02-16

--- Comment #1 from kargl at gcc dot gnu.org ---
Only want to access the components of a derived type if we have an actual
derived type.

diff --git a/gcc/fortran/resolve.cc b/gcc/fortran/resolve.cc
index 835a4783718..ef274e05d4a 100644
--- a/gcc/fortran/resolve.cc
+++ b/gcc/fortran/resolve.cc
@@ -1296,7 +1296,7 @@ resolve_structure_cons (gfc_expr *expr, int init)
   if (expr->ref)
     comp = expr->ref->u.c.sym->components;
   else
-    comp = expr->ts.u.derived->components;
+    comp = expr->ts.type == BT_DERIVED ? expr->ts.u.derived->components :
NULL;

   for (; comp && cons; comp = comp->next, cons = gfc_constructor_next (cons))
     {

Reply via email to