J3/04-360
Date: 12th July 2004
To: J3
From: Malcolm Cohen
Subject: VALUE attribute for polymorphic dummy arguments
NUMBER:
TITLE: VALUE attribute for polymorphic dummy arguments
KEYWORDS: VALUE, CLASS
DEFECT TYPE:
STATUS: J3 consideration in progress
QUESTION:
The VALUE attribute is not allowed for any dummy argument that has a
(visible) nonconstant length type parameter. (Or indeed for any array.)
The intent appears to be to restrict VALUE arguments to being of
constant size.
However consider:
SUBROUTINE S(x)
CLASS(t),VALUE :: x
...
There is no requirement that X not be polymorphic, so this requires copying
a variable (known only at runtime) sized value, in violation of the
apparent intent of the other restrictions. For example, X might have
an invisible nonconstant length type parameter in its dynamic type; this
allows the user to bypass that particular VALUE restriction simply by
obfuscating his code so that the nonconstant length type parameter is
in the dynamic type but not in the declared type.
Should there be a restriction that a VALUE dummy argument not be polymorphic?
ANSWER:
Yes, this restriction was accidentally omitted.
An edit is provided to fix this oversight.
DISCUSSION:
The deduced intent is apparent from the rejection of the UK comment C7 on
the FCD ballot.
WG5 agreed that the existing constraint was inconsistent, but
felt that there were potential implementation concerns with
deleting it completely. Therefore, the constraint was
instead modified to a simpler and more consistent form.
EDITS:
[72:23] Append "It shall not have the VALUE attribute."
SUBMITTED BY: Malcolm Cohen
HISTORY: J3/04-360 m169 Submitted