[Mpi-forum] Compile problems with examples in MPI Standard

N.M. Maclaren nmm1 at cam.ac.uk
Tue Jul 24 10:28:04 CDT 2012

On Jul 24 2012, William Gropp wrote:

> I've run my code checker over the examples in the MPI-3 Standard, and 
> I've found some issues. Perhaps the biggest is this (a typical example):
> Opening file one-side-2.tex ex5501.c: In function 'main': ex5501.c:58: 
> warning: passing argument 2 of 'MPI_Init' from incompatible pointer type
> This occurs everywhere we include MPI_Init in an example. The compiler is 
> gcc 4.2.1 . The corresponding declaration of argv is as intended:
>int main(int argc, char *argv[]) 
> The declaration in MPI_Init looks correct (argv is a pointer to an array 
> of pointers to char). Is this a place where we should stick with the *** 
> notation just to keep compilers happy? Or is there something I'm missing 
> in the declaration?

How does your code checker work?

This is an area where the C standard is ambiguous, but 'everybody knows'
what it is supposed to mean.  I tried to get it fixed several times in
WG14, but failed every time :-(  C++ is subtly different, and it is just
about possible that you have tripped across something there.  But it is
an area which is so fiendish that few people can even imagine the horrors
hidden under the carpet.

If you can send me a code fragment and compilation command, including
the exact declaration of MPI_Init, sufficient to reproduce the effect,
I will check whether it is a bug in your checker or what.

Nick Maclaren.

More information about the mpi-forum mailing list