[J3] DIM arguments

Malcolm Cohen malcolm at nag-j.co.jp
Wed Mar 6 19:04:19 EST 2019

In F2018, the DIM argument of ANY is not an optional dummy argument.  There are two forms of ANY: one with no DIM argument, one with a non-OPTIONAL DIM argument.


Thus this follows the usual rules.  Viz, in Argument presence and restrictions on arguments not present, it says “An optional dummy argument that is not present is subject to the following restrictions… It shall not be supplied as an actual argument corresponding to a nonoptional dummy argument…”


Thus the code is valid, and the reference is to the second form of ANY, not the first.  I repeat: the DIM argument of ANY is not OPTIONAL, it is just like a generic overload.




..............Malcolm Cohen, NAG Oxford/Tokyo.


From: J3 <j3-bounces at mailman.j3-fortran.org> On Behalf Of Bill Long via J3
Sent: Thursday, March 7, 2019 8:21 AM
To: General J3 interest list <j3 at mailman.j3-fortran.org>
Cc: Bill Long <longb at cray.com>
Subject: [J3] DIM arguments


For this example:

subroutine boo(a,i)
logical,intent(in) :: a(10,10)
integer,optional :: i
if (present(i)) then
print *, any(a,i)
print *, any(a)
end if

F08 gave an error because there was a specific requirement in the (then) optional DIM argument: 

""The corresponding actual argument shall not be an optional dummy argument.”

In F2018 we changed the DIM argument to be not optional. But we also deleted the restriction sentence. Was that intentional? It seems that (according to the logic in interp F08/0038) that we did not want to allow optional arguments to correspond to the DIM argument of the ANY function. But the restrictions on the use of optional arguments alone (absent the specific prohibition for the DIM argument of ANY) appear to make the above code conforming. Or maybe the prohibition is stated elsewhere for these DIM arguments, and I’m not seeing it. 


Bill Long longb at cray.com <mailto: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


The Numerical Algorithms Group Ltd is a company registered in England and Wales with company number 1249803. The registered office is: Wilkinson House, Jordan Hill Road, Oxford OX2 8DR, United Kingdom. Please see our Privacy Notice <https://www.nag.co.uk/content/privacy-notice>  for information on how we process personal data and for details of how to stop or limit communications from us.

This e-mail has been scanned for all viruses and malware, and may have been automatically archived by Mimecast Ltd, an innovator in Software as a Service (SaaS) for business.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.j3-fortran.org/pipermail/j3/attachments/20190307/1704ba00/attachment-0001.html>

More information about the J3 mailing list