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

Thomas Koenig <tkoenig at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |tkoenig at gcc dot gnu.org

--- Comment #16 from Thomas Koenig <tkoenig at gcc dot gnu.org> ---
This patch

> Draft patch - one probably needs to do something similar for derived types.
> 
> --- a/gcc/fortran/decl.c
> +++ b/gcc/fortran/decl.c
> @@ -1500,6 +1500,8 @@ add_init_expr_to_sym (const char *name, gfc_expr
> **initp, locus *var_locus)
>                                              &init->where);
> 
>               array->shape = gfc_get_shape (sym->as->rank);
> +             if (init->ts.type == BT_CHARACTER)
> +               array->ts.u.cl = init->ts.u.cl;
>               for (n = 0; n < sym->as->rank; n++)
>                 spec_dimen_size (sym->as, n, &array->shape[n]);

fixes the test case, but regresses 

program p
   character(1), parameter :: x1(2) = 'a'
   character(*), parameter :: x2(2) = x1
end

which is a part of pr68154.f90 .

Reply via email to