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

Van Snyder Van.Snyder at jpl.nasa.gov
Wed Dec 3 17:47:00 EST 2008


On Wed, 2008-12-03 at 01:52 -0800, N.M. Maclaren wrote:
> Van wrote
> >1.  Provide an attribute for a variable that says accesses to it are
> >atomic.
> 
> The killer here is Fortran's expression evaluation model, which is why
> VOLATILE is so toxic.  As Fortran is specified, variable references
> have essentially the same properties as function calls - i.e. in an
> arbitrary order and a compiler may omit any it can deduce the value of
> in other ways. VOLATILE provides a hand-waving exception to this, but
> %deity alone knows exactly what it means in any language that has it.
> 
> Now, it would be possible to add a restriction that there is only one
> atomic access per statement, but that is probably too restrictive.
> However, if that is not done, the effects are completely unpredictable
> unless Fortran starts to define the ordering semantics of expression
> evaluation.

I don't see the difference here from calls to the atomic subroutines
within DO CONCURRENT constructs.  They're explicitly unordered.

The problem with VOLATILE is not Fortran's expression evaluation rules.
It is that VOLATILE doesn't have the desired semantics.  It just says
"turn off the register allocator."  This is different from ATOMIC.

-- 
Van Snyder                    |  What fraction of Americans believe 
Van.Snyder at jpl.nasa.gov       |  Wrestling is real and NASA is fake?
Any alleged opinions are my own and have not been approved or
disapproved by JPL, CalTech, NASA, the President, or anybody else.



More information about the J3 mailing list