Open MPI logo

Open MPI User's Mailing List Archives

  |   Home   |   Support   |   FAQ   |   all Open MPI User's mailing list

Subject: [OMPI users] Initializing OMPI with invoking the array constructor on Fortran derived types causes the executable to crash
From: Stefan Mauerberger (stefan.mauerberger_at_[hidden])
Date: 2013-01-11 08:01:43

Hi There!

First of all, this is my first post here. In case I am doing something
inappropriate pleas be soft with me. On top of that I am not quite sure
whether that issue is related to Open MPI or GCC.

Regarding my problem: Well, it is a little bulky, see below. I could
figure out that the actual crash is caused by invoking Fortran's array
constructor [ xx, yy ] on derived-data-types xx and yy. The one key
factor is that those types have allocatable member variables.
Well, that fact points to blame gfortran for that. However, the crash
does not occur if MPI_Iinit is not called in before. Compiled as a
serial program everything works perfectly fine. I am pretty sure, the
lines I wrote are valid F2003 code.

Here is a minimal working example:
    USE mpi

    INTEGER :: ierr

    TYPE :: test_typ
        REAL, ALLOCATABLE :: a(:)

    TYPE(test_typ) :: xx, yy
    TYPE(test_typ), ALLOCATABLE :: conc(:)

    CALL mpi_init( ierr )

    conc = [ xx, yy ]

    CALL mpi_finalize( ierr )
Just compile with mpif90 ... and execute leads to:
> *** glibc detected *** ./a.out: free(): invalid pointer: 0x00007fefd2a147f8 ***
> ======= Backtrace: =========
> /lib/x86_64-linux-gnu/[0x7fefd26dab96]
> ./a.out[0x400fdb]
> ./a.out(main+0x34)[0x401132]
> /lib/x86_64-linux-gnu/[0x7fefd267d76d]
> ./a.out[0x400ad9]
With commenting out 'CALL MPI_Init' and 'MPI_Finalize' everything seems to be fine.

What do you think: Is this a OMPI or a GCC related bug?