(j3.2006) (SC22WG5.3665) [ukfortran] N1755: Request for new features from MPI Forum
Van Snyder
Van.Snyder
Tue Nov 11 19:13:21 EST 2008
On Tue, 2008-11-11 at 15:51 -0800, Bill Long wrote:
> > 2. "C559 An entity with the VOLATILE attribute shall be a variable that is not
> > an INTENT (IN) dummy argument."
> > Please explain this one to me.
> >
>
> INTENT(IN) implies that the dummy argument does not change its value
> (for the non-pointer case) inside the subprogram. It allows the
> compiler to snap a copy of the variable in a register and keep it there
> throughout execution of the subprogram, for example. Pretty much
> completely incompatible with the implications of volatile.
Mo, INTENT(IN) says that such a dummy argument shall not appear in a
variable definition context. Without VOLATILE that's (almost) the same
thing, but if the actual argument really is volatile, wouldn't
INTENT(IN) + VOLATILE say "don't take a copy?"
Given that INTENT(IN) on its own is incompatible with VOLATILE, isn't
that a reason to specify VOLATILE when it's needed, instead of not being
able to specify it?
Prohibiting VOLATILE + VALUE is even more nonsensical, since the
procedure is allowed to change VALUE dummy arguments. Why can't one
change while you're not looking? VOLATILE + VALUE means "take a copy,
and then the copy might change while you're not looking."
Do we prohibit these?
integer, intent(in), target :: X
integer, pointer, volatile :: Y
Y => X
call foobar ( Y ) ! which keeps Y and makes volatile changes
! to its target
integer, value, target :: X
integer, pointer, volatile :: Y
Y => X
call foobar ( Y ) ! which keeps Y and makes volatile changes
! to its target
I couldn't find a constraint in 7.2.2 "If the <pointer-object> has the
VOLATILE attribute the target shall not have the VALUE or INTENT(IN)
attributes."
If we don't prohibit them, why bother with the cases that don't involve
pointers?
I also didn't find constraints in 5.3.18-19 against TARGET + VALUE or
VOLATILE.
Indeed, I didn't find a constraint against TARGET + INTENT(IN), so I
hope INTENT(IN) doesn't mean what Bill says, at least in this case.
--
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