The example below shows that besides the fact that declared as INTENT(OUT) the component 'n' is not initialized per default the second time. This is demanded by the FORTRAN standard. Example code: program main
type :: container_t integer :: n = 0 ! if the following line is omitted, the problem disappears integer, dimension(:), allocatable :: a end type container_t type(container_t) :: container call init (container) print *, "Initial state:" call dump (container) container%n = 1 print *, "Modified state:" call dump (container) call init (container) print *, "Initial state again:" call dump (container) contains subroutine init (container) type(container_t), intent(out) :: container end subroutine init subroutine dump (container) type(container_t), intent(in) :: container print "(A,I0,1x,L)", " value = ", container%n end subroutine dump end program main -- Summary: wrong code, mis-initialization Product: gcc Version: 4.5.0 Status: UNCONFIRMED Severity: blocker Priority: P3 Component: fortran AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: reuter at physik dot uni-freiburg dot de GCC build triplet: i386-32bit, MAC OS X Leopard GCC host triplet: i386-32bit, MAC OS X Leopard GCC target triplet: i386-32bit, MAC OS X Leopard http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41479