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

--- Comment #5 from Harald Anlauf <anlauf at gcc dot gnu.org> ---
Further reduced:

program test
  implicit none
  type tag3
     character(4) :: c3(2) = ""
  end type tag3

! type(tag3), parameter   :: u = tag3(['opqr','strv']) ! works
  type(tag3), parameter   :: u = tag3( 'opqr'        ) ! fails
  type(tag3)              :: v = u
  integer,    parameter   :: m = storage_size (u) / 8
  integer                 :: j = m
  character, dimension(m) :: ww1, ww2, ww3, ww4

  ww1 = transfer(u,'*',j)    ! not simplified (j is variable)
  ww2 = transfer(v,'*',j)
  ww3 = transfer(v,'*',m)    ! not simplified (m is variable)
  ww4 = transfer(u,'*',m)    ! <<< bad simplification
  print *, ww1
  print *, ww2
  print *, ww3
  print *, ww4
end

This prints:

 opqropqr
 opqropqr
 opqropqr
 opqr^@^@^@^@

The expansion of the array initializers seems to not work here properly.

Reply via email to