[MPIWG Fortran] MPI-3 ticket 349: Fortran question
Bill Long
longb at cray.com
Thu Jan 2 10:46:39 CST 2014
On 1/2/14 10:36 AM, Dave Goodell (dgoodell) wrote:
> On Dec 24, 2013, at 11:36 AM, Jim Dinan <james.dinan at gmail.com> wrote:
>
>> Given that MPI_Aint will be at least the same size as ptrdiff_t, do we
>> actually have a problem with subtracting MPI_Aints to find pointer diffs?
>> It seems like this may actually be ok.
>
> There's still a problem. I don't think that ptrdiff_t has anything to do with it since that normally only comes into play when you subtract two _pointers_, not two integers acting sort of like pointers.
>
>
> The overflow occurs because "(a - b)" is really "(-9223372036854775808 - 9223372036854775804)" in signed integer arithmetic. Note that most implementations will give you the expected value if you don't set '-ftrapv', but that's *undefined behavior* according to the C standard and should not be relied upon (see http://www.airs.com/blog/archives/120).
>
> This is all just the C side of things. I have no idea whether Fortran integer overflow is defined.
>
Fortran rule:
The execution of any numeric operation whose result is not defined by
the arithmetic used by the processor is prohibited.
Cheers,
Bill
> -Dave
>
> _______________________________________________
> mpiwg-fortran mailing list
> mpiwg-fortran at lists.mpi-forum.org
> http://lists.mpi-forum.org/mailman/listinfo.cgi/mpiwg-fortran
>
--
Bill Long longb at cray.com
Fortran Technical Support & voice: 651-605-9024
Bioinformatics Software Development fax: 651-605-9142
Cray Inc./Cray Plaza, Suite 210/380 Jackson St./St. Paul, MN 55101
More information about the mpiwg-fortran
mailing list