(j3.2006) Specification expressions
Van Snyder
Van.Snyder
Thu Feb 8 20:41:15 EST 2018
Maybe I missed it, but as far as I can tell, the following are allowed:
integer :: A(size(b))
integer :: B(size(a))
I didn't see anything in 10.1.11p2 that requires the variable that is
the subject of a specification inquiry to be previously declared if not
accessed by use or host association (which are now understood to be
"previously declared").
Another one that seems problematic is
real, pointer :: X(:)
real, allocatable :: Y(:)
real :: Z(size(x), size(y))
This violates the prohibition against inquiring the properties (e.g.
size) of a disassociated or undefined pointer, or a deallocated
deallocatable variable. It would be helpful if this example fell under
the rubric of C1010, e.g., size(x) is not a specification expression if
X has the pointer or allocatable attribute and is declared in the same
specification part, or is not declared earlier in the same specification
part.
Can we sharpen the list in 10.1.11p2? Certainly not in the present
revision, but as a clean-up next time? Something like
10.1.11.2p2(7)(a)
(iv) declared later in the same specification part, or
(v) declared in the same specification part if the variable has
the ALLOCATABLE or POINTER attribute,
These would result in a compile-time error message about a violation of
C1010, instead of an inscrutable run-time failure.
More information about the J3
mailing list