This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug fortran/51434] ICE with scalar init of an array parameter, used in DT default init with transfer
- From: "tkoenig at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Sun, 24 Sep 2017 10:31:23 +0000
- Subject: [Bug fortran/51434] ICE with scalar init of an array parameter, used in DT default init with transfer
- Auto-submitted: auto-generated
- References: <bug-51434-4@http.gcc.gnu.org/bugzilla/>
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 .