[mpich-discuss] Erroneous MPI type tag warning

Markus Geimer m.geimer at fz-juelich.de
Sun Dec 22 03:56:06 CST 2013


Dear MPICH developers,

When compiling the attached example with MPICH 3.1rc2 using Clang 3.3,
I get the following compiler warnings:

-------------------- snip --------------------
mpi2int.c:17:20: warning: argument type 'int *' doesn't match specified
'MPI' type tag [-Wtype-safety]
    MPI_Reduce(in, out, 1, MPI_2INT, MPI_MAXLOC, 0, MPI_COMM_WORLD);
                   ^~~     ~~~~~~~~
mpi2int.c:17:16: warning: argument type 'int *' doesn't match specified
'MPI' type tag [-Wtype-safety]
    MPI_Reduce(in, out, 1, MPI_2INT, MPI_MAXLOC, 0, MPI_COMM_WORLD);
               ^~          ~~~~~~~~
2 warnings generated.
-------------------- snip --------------------

According to the MPI standard, however, MPI_2INT is a datatype as if
defined by

        MPI_Type_contiguous(2, MPI_INT, MPI_2INT)

i.e., 'int[2]' should be a perfect match. This is not necessarily true
for the type used for comparison,

        struct mpich_struct_mpi_2int { int i1; int i2; };

which will only be contiguous if the compiler does not add any padding.

Is there any chance this gets fixed for the final 3.1 release? Or did
I miss something?

Thanks,
Markus

--
Dr. Markus Geimer
Juelich Supercomputing Centre
Institute for Advanced Simulation
Forschungszentrum Juelich GmbH
52425 Juelich, Germany

Phone:  +49-2461-61-1773
Fax:    +49-2461-61-6656
E-mail: m.geimer at fz-juelich.de
WWW:    http://www.fz-juelich.de/jsc/


------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------
Forschungszentrum Juelich GmbH
52425 Juelich
Sitz der Gesellschaft: Juelich
Eingetragen im Handelsregister des Amtsgerichts Dueren Nr. HR B 3498
Vorsitzender des Aufsichtsrats: MinDir Dr. Karl Eugen Huthmacher
Geschaeftsfuehrung: Prof. Dr. Achim Bachem (Vorsitzender),
Karsten Beneke (stellv. Vorsitzender), Prof. Dr.-Ing. Harald Bolt,
Prof. Dr. Sebastian M. Schmidt
------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------

-------------- next part --------------
A non-text attachment was scrubbed...
Name: mpi2int.c
Type: text/x-csrc
Size: 415 bytes
Desc: not available
URL: <http://lists.mpich.org/pipermail/discuss/attachments/20131222/889e50c8/attachment.bin>


More information about the discuss mailing list