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

--- Comment #10 from janus at gcc dot gnu.org ---
(In reply to janus from comment #9)
> The following patch seems to be sufficient to fix the regression:


... however, it lacks a safety check for the existence of the ctor expression.
This variant regtests cleanly:


Index: gcc/fortran/expr.c
===================================================================
--- gcc/fortran/expr.c  (revision 262509)
+++ gcc/fortran/expr.c  (working copy)
@@ -4650,6 +4650,10 @@ gfc_generate_initializer (gfc_typespec *ts, bool g
            }
        }

+      /* Make sure that locus is set.  */
+      if (ctor->expr && (!ctor->expr->where.nextc || !ctor->expr->where.lb))
+       ctor->expr->where = init->where;
+
       gfc_constructor_append (&init->value.constructor, ctor);
     }

Reply via email to