(j3.2006) (SC22WG5.3712) [ukfortran] Atomic stuff

N.M. Maclaren nmm1
Wed Dec 3 13:14:52 EST 2008

On Dec 3 2008, Jim Xia wrote:
>Now I take another look at the atomic stuff we worked out in Tokyo, I 
>think there is an issue we didn't address: alignment.  Consider on a 
>system we have atomic_integer_kind being 4 bytes, and the processor also 
>supports 2 byte integers, then the following declarations
>    integer(2) x(3)
>    integer(ATOMIC_INTEGER_KIND) y, z
>    equivalence (y, x(2))
>    equivalence (z, x)
>Now either y or z is out of natural alignment.  This will certainly cause 
>implementation problems on atomic operations on y and z.  We have to 
>disallow this to happen.

Already done for that example - see Note 5.42 in But let's say 
that we make the appropriate changes to avoid that. Then it is clobbered by 
constraint C589, C590, C591 and

The problem has been there since time immemorial in the case of systems 
where unaligned access is not supported (especially for DOUBLE PRECISION). 
Yes, I know that the IBM System/360 (sic) Fortran library trapped the 
interrupts and fixed up the alignment, but that was a performance disaster, 
not all compilers did and some still don't. But, curiously, I can't find 
where that that one is locked out.

Nick Maclaren,
University of Cambridge Computing Service,
New Museums Site, Pembroke Street, Cambridge CB2 3QH, England.
Email:  nmm1 at cam.ac.uk
Tel.:  +44 1223 334761    Fax:  +44 1223 334679

More information about the J3 mailing list