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

--- Comment #5 from Harald Anlauf <anlauf at gmx dot de> ---
The following patch fixes the testcase and seems to pass regression testing.

Index: gcc/fortran/decl.c
===================================================================
--- gcc/fortran/decl.c  (revision 268369)
+++ gcc/fortran/decl.c  (working copy)
@@ -1921,7 +1921,7 @@
                    }
                  else if (init->ts.u.cl && init->ts.u.cl->length)
                    sym->ts.u.cl->length =
-                               gfc_copy_expr (sym->value->ts.u.cl->length);
+                               gfc_copy_expr (init->ts.u.cl->length);
                }
            }
          /* Update initializer character length according symbol.  */


Maybe it needs to be checked against a larger code base.

It changes (and hopefully fixes) almost 10-year old code.

Thanks, Dominique, for pointing to the right area.

Reply via email to