Open MPI logo

Open MPI User's Mailing List Archives

  |   Home   |   Support   |   FAQ   |  

This web mail archive is frozen.

This page is part of a frozen web archive of this mailing list.

You can still navigate around this archive, but know that no new mails have been added to it since July of 2016.

Click here to be taken to the new web archives of this list; it includes all the mails that are in this frozen archive plus all new mails that have been sent to the list since it was migrated to the new archives.

Subject: Re: [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-14 13:55:47


On Mon, 2013-01-14 at 12:00 -0500, users-request_at_[hidden] wrote:
> Could you try to run your serial program in Valgrind and see if it
> reports any erroneous memory access attempts? It could be that GCC's
> implementation of the automatic allocation is broken and that OMPI's
> intervention in the memory management process only exposes an already
> existing problem.
Well, I heard about Valgrind at some time but I am not comfortable in
using it. Anyway, I simply considered the following code
> PROGRAM main
>
> TYPE :: test_typ
> REAL, ALLOCATABLE :: a(:)
> END TYPE
>
> TYPE(test_typ) :: xx, yy
> TYPE(test_typ), ALLOCATABLE :: conc(:)
>
> xx = test_typ( [1.0] )
> yy = test_typ( [1.0,2.0,3.0] )
>
> conc = [ xx, yy ]
>
> END PROGRAM main
and built it with 'gfortran -g test.f90 -o test'. Subsequently, I run it
in Valgrind, 'valgrind --track-origins=yes ./test'. The unpleasant
result is:
> ==19519== Memcheck, a memory error detector
> ==19519== Copyright (C) 2002-2011, and GNU GPL'd, by Julian Seward et al.
> ==19519== Using Valgrind-3.7.0 and LibVEX; rerun with -h for copyright info
> ==19519== Command: ./test
> ==19519==
> ==19519== Conditional jump or move depends on uninitialised value(s)
> ==19519== at 0x401030: MAIN__ (test_conc.f90:13)
> ==19519== by 0x40118B: main (test_conc.f90:15)
> ==19519== Uninitialised value was created by a heap allocation
> ==19519== at 0x4C2B3F8: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
> ==19519== by 0x400DCB: MAIN__ (test_conc.f90:13)
> ==19519== by 0x40118B: main (test_conc.f90:15)
> ==19519==
> ==19519==
> ==19519== HEAP SUMMARY:
> ==19519== in use at exit: 0 bytes in 0 blocks
> ==19519== total heap usage: 26 allocs, 26 frees, 12,111 bytes allocated
> ==19519==
> ==19519== All heap blocks were freed -- no leaks are possible
> ==19519==
> ==19519== For counts of detected and suppressed errors, rerun with: -v
> ==19519== ERROR SUMMARY: 2 errors from 1 contexts (suppressed: 2 from 2)
Well, how to interpret ...

Thanks for that very useful advice. As far as I can see, there seems to
be something wrong with GCC's array-constructor implementation when
allocatables are invoked.

Cheers,
Stefan