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

--- Comment #4 from janus at gcc dot gnu.org ---
Extension / variation of the test case:


program    read_exp_data
   implicit none

   type experimental_data_t
      character(len=:), dimension(:), allocatable :: header
   end type

   type(experimental_data_t) :: ex
   integer, parameter :: nh = 3
   integer :: i

   allocate(character(len=2) :: ex%header(nh))

   ex%header(3) = "C"
   ex%header(2) = "B"
   ex%header(1) = "A"

   do i = 1, nh
      write(*,*) "header(",i,") = ", ex%header(i), " loc: ", loc(ex%header(i))
   enddo

end program


This prints:

 header(           1 ) = A  loc:              16642032
 header(           2 ) = A  loc:              16642032
 header(           3 ) = A  loc:              16642032


which shows that the problem is apparently not only in the writing into the
array, but also in the output. All elements appear to have the same address!

Reply via email to