If an array of a derived type is declared and one component is set to zero then all the components are set to zero. The following program illustrates the problem:
program test_assign type my_type integer :: a integer :: b end type my_type type(my_type), dimension(1) :: mine mine%b=4 print *, "Should be 4: ", mine%b mine%a=1 print *, "Should be 4: ", mine%b mine%a=0 print *, "Should be 4: ", mine%b print *, "Should be 0: ", mine%a end program test_assign The output of this is: Should be 4: 4 Should be 4: 4 Should be 4: 0 Should be 0: 0 Note the third line. -- Summary: Zeroing one component of array of derived types zeros the whole structure. Product: gcc Version: 4.3.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: fortran AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: David at ham dot dropbear dot id dot au GCC build triplet: RHEL4 x86_64 GCC host triplet: RHEL4 x86_64 GCC target triplet: RHEL4 x86_64 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31620