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);

Reply via email to