It happened again, I am faced with some Fortran problems which I can't
What I define is just a derived-type having only an allocatable array
as component. In addition there is a function whose result is an
allocatable array of that type. It is a little hard to explain so I
simply attached some example code.
Without having MPI initialized, everything works perfectly fine.
However, when including the code into a parallel program it crashes
due to some reason. Actually, when setting the array's length to 0,
the it works.
When building with GCC+OpenMPI it throws a segmentation fault saying
'invalid pointer'. Ifort+IntelMPI returns an array of size=0 in any
From my point of view, this is totally wired. Do you have any idea on
what is going wrong here?
TYPE :: my_type
REAL, ALLOCATABLE :: a(:)
TYPE(my_type), ALLOCATABLE :: test_typ(:)
CALL MPI_INIT( mpi_ierr )
test_typ = ret_fct( 10 )
CALL MPI_FINALIZE( mpi_ierr )
FUNCTION ret_fct( sz ) RESULT( abcd )
INTEGER :: sz
TYPE(my_type), ALLOCATABLE :: abcd(:)
ALLOCATE( abcd( sz ) )
END FUNCTION ret_fct
END PROGRAM main