Derived data with allocatable integer and character arrays


I got unexpected results with allocattable arrays of derived data, when resizing the allocatable array of derived data.

Specifically, in the example of code bellow
resizing atmp with
atmp = atmp(1:i0)
gives unexpected/incorrect character field.
interestingly, saving resized array into a different array works fine:
a = atmp(1:i0)
Also, Integer fields are OK for both cases.

Is this a compiler bug ?

Bellow code illustrate the case:

  module a_m
     type a_t
        integer,allocatable :: i(:)
        character(4),allocatable  :: c(:)
     end type a_t
   end module a_m

   program main
   use a_m
   implicit none
   integer i0
   type ( a_t ) , allocatable :: atmp(:), a(:)
   type ( a_t ) one

   allocate(atmp(20)) ! just take a sufficient large array

   i0 = 1
   one%i = (/1/)
   one%c = (/'A1  '/)
   atmp(i0) = one

   a=atmp(1:i0)    ! this works ok

   atmp = atmp(1:i0)    ! resize atmp ; this fails for character atmp%sy; 

   print*, 'atmp1%sy = "'//atmp(1)%c//'"' ! not good

   print*, 'a%sy = "'//a(1)%c//'"' ! that is OK

   end program main