(Tried to open a bug, but I don't seem to have access...)

Environment:

Fedora Core 5 (actually I think any Linux will do)
OMPI 1.2b1 (./configure --with-devel-headers)

Symptom:

MPI_Init(&argc, &argv) corrupts the argc variable.

Repeat By:

1. Compile the following program using 'mpicc -g -o mpitest mpitest.c':

#include <mpi.h>

int main(int argc, char *argv[])
{
        MPI_Init(&argc, &argv);
        MPI_Finalize();
}

2. See corruption under gdb:

$ gdb mpitest
GNU gdb 6.5
Copyright (C) 2006 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB. Type "show warranty" for details. This GDB was configured as "i686-pc-linux-gnu"...Using host libthread_db library
"/lib/libthread_db.so.1".

(gdb) b main
Breakpoint 1 at 0x80485c5: file mpitest.c, line 6.
(gdb) r
Starting program: /home/greg/mpitest
[Thread debugging using libthread_db enabled]
[New Thread -1208936784 (LWP 11171)]
[Switching to Thread -1208936784 (LWP 11171)]

Breakpoint 1, main (argc=1, argv=0xbf81fae4) at mpitest.c:6
6               MPI_Init(&argc, &argv);
(gdb) p argc
$1 = 1
(gdb) n
7               MPI_Finalize();
(gdb) p argc
Cannot access memory at address 0x0
(gdb)

Reply via email to