[Bug fortran/68155] ICE on initializing character array in type (len_lhs <> len_rhs)
anlauf at gmx dot de
gcc-bugzilla@gcc.gnu.org
Wed Mar 28 19:15:00 GMT 2018
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68155
--- Comment #10 from Harald Anlauf <anlauf at gmx dot de> ---
The structure constructor seems to lose the character length, which
can be best seen from the tree dump.
program p
implicit none
type t
! character(3) :: c1(2) = [ 'b', 'c'] ! OK
! character(3) :: c2(2) = [ character(1) :: 'b', 'c'] // "" ! OK
! character(3) :: c3(2) = [ 'b', 'c'] // "" ! ICE
character(3) :: c4(2) = [ '' , '' ] // "" ! wrong output
end type t
type(t) :: z
! print *, "'", z%c1(2), "'" ! OK
! print *, "'", z%c2(2), "'" ! OK
! print *, "'", z%c3(2), "'" ! ICE
print *, "'", z%c4(2), "'" ! wrong output: '^@^@^@'
end
% grep c4 pr68155-zz4b.f90.003t.original
static struct t z = {.c4={"", ""}}; <--- length 0!
_gfortran_transfer_character_write (&dt_parm.0, &z.c4[1], 3);
More information about the Gcc-bugs
mailing list