[J3] Vector subscripts and INTENT(INOUT)

Bill Long longb at cray.com
Tue May 15 12:22:12 EDT 2018

I can imagine that there are pre-F90 subprograms (before INTENT existed) that could be callable with an actual argument with a vector subscript, and that no one is interested in going back and specifying intents for the arguments of the routine.  I suspect that was the argument in 1990 when the current argument association wording was added that essentially duplicates the semantics of INTENT(IN).   As time goes on, less and less of that sort of ancient code remains used, or at least not modernized.  So perhaps in the future we could start requiring INTENT(IN) in this case - it makes the standard more internally consistent and provides the change for better compile-time checking for errors. 

I did go back and look at old standards.  F2008, in the “Vector subscript” subclause of 6, has “An array section with a vector subscript shall not be argument associated with a dummy array that is defined or redefined.”.    That is the “shall not” rule that supports the factual claim in the argument association clause that the dummy is undefinable.   The same rule is in all the standards going back to F90.   For some reason it was dropped in the F2018 draft, which is the one I was originally reading.  If it was added back into F2018, then there would be a rule-based justification for the claim that the dummy argument is not definable. I would find that a substantial improvement. 

> On May 15, 2018, at 12:03 AM, Malcolm Cohen via J3 <j3 at mailman.j3-fortran.org> wrote:
> IMO the suggested incompatible change to require INTENT(IN) or VALUE for passing vector-subscripted array sections is completely and utterly unacceptable.  I speak as a user.  Even if we made such a change, it is highly likely that users will demand compilation of their previously-conforming code.
> > none of the 4 compilers I tried on this code issued any message
> The NAG compiler can detect violation of this requirement at runtime (and has had that capability for a long time).  It’s not something that can in general be detected at compile time (though of course some simple cases could be).

Compile time checking is generally not possible if the callee is in a pre-compiled library.  If the compiler has access to the source code for the callee, then it can be checked.   That covers a lot of cases, and is arguably better than nothing. 


> Cheers,
> -- 
> ..............Malcolm Cohen, NAG Oxford/Tokyo.

Bill Long                                                                       longb at cray.com
Principal Engineer, Fortran Technical Support &   voice:  651-605-9024
Bioinformatics Software Development                      fax:  651-605-9143
Cray Inc./ 2131 Lindau Lane/  Suite 1000/  Bloomington, MN  55425

More information about the J3 mailing list