Open MPI logo

Open MPI Development Mailing List Archives

  |   Home   |   Support   |   FAQ   |   all Development mailing list

Subject: Re: [OMPI devel] bug in openmpi-1.3/ompi/mpi/f77/profile/pcart_coords_f.c
From: Rainer Keller (keller_at_[hidden])
Date: 2009-02-04 10:19:16


Hello Mr. Wuellen,
thanks for the bug report!

On Wednesday 04 February 2009 09:21:38 am Christoph van Wüllen wrote:
> there is an error in the above mentioned file, in line 74:
>
> if (MPI_SUCCESS == OMPI_FINT_2_INT(*ierr)) {
> OMPI_ARRAY_INT_2_FINT(coords, OMPI_FINT_2_INT(*maxdims));
>
> the OMPI_ARRAY_INT_2_FINT macro uses the second argument with
> pre-decrement, such that it must be an lvalue and should not
> contain a type-cast.
>
> In the built at hand this code expands to
>
> if (0 == (int) (*ierr)) {
> while((int) (*maxdims) > 0) { coords[(int) (*maxdims) - 1] =
> c_coords[(int) (*maxdims) - 1]; --(int) (*maxdims); } free(c_coords);
> }
>
> if MPI_FINT is, e.g. "long long" (that is, if FORTRAN integers are
> 64 bit, but C int/long is 32 bit), and
>
> --(int) (*maxdims)
>
> is not correct syntactically. I guess one could omit the
> OMPI_FINT_2_INT in the second line, but you should check this.

Good catch.
That was introduced by me in r14762, where I didn't notice the lvalue usage.

This should be moved into the v1.3.1 release.

> Anyway, bad testing. The code has probably never been build for
> FORTRAN with 64-bit integers.
Hmm, not by me after r8254, when the same applied to sizeof(logical)!=
sizeof(int)... Then I tested these cases.

Thanks again.

With best regards,
Rainer Keller

-- 
------------------------------------------------------------------------
Rainer Keller, PhD                  Tel: (865) 241-6293
Oak Ridge National Lab          Fax: (865) 241-4811
PO Box 2008 MS 6164           Email: keller_at_[hidden]
Oak Ridge, TN 37831-2008    AIM/Skype: rusraink