Information technology — Further interoperability of Fortran with C

ISO/IEC TS 29113:2012 specifies the form and establishes the interpretation of facilities that extend the Fortran language defined by ISO/IEC 15391:2010. The purpose of ISO/IEC TS 29113:2012 is to promote portability, reliability, maintainability and efficient execution of programs containing parts written in Fortran and parts written in C, for use on a variety of computing systems.

Technologies de l'information — Interopérabilité ultérieure de Fortran avec C

General Information

Status
Withdrawn
Publication Date
22-Nov-2012
Withdrawal Date
22-Nov-2012
Current Stage
9599 - Withdrawal of International Standard
Completion Date
11-Mar-2020
Ref Project

Buy Standard

Technical specification
ISO/IEC TS 29113:2012 - Information technology -- Further interoperability of Fortran with C
English language
54 pages
sale 15% off
Preview
sale 15% off
Preview

Standards Content (Sample)

TECHNICAL ISO/IEC
SPECIFICATION TS
29113
First edition
2012-12-01


Information technology — Further
interoperability of Fortran with C
Technologies de l'information — Interopérabilité ultérieure de Fortran
avec C




Reference number
ISO/IEC TS 29113:2012(E)
©
ISO/IEC 2012

---------------------- Page: 1 ----------------------
ISO/IEC TS 29113:2012(E)

COPYRIGHT PROTECTED DOCUMENT


©  ISO/IEC 2012
All rights reserved. Unless otherwise specified, no part of this publication may be reproduced or utilized in any form or by any means,
electronic or mechanical, including photocopying and microfilm, without permission in writing from either ISO at the address below or
ISO's member body in the country of the requester.
ISO copyright office
Case postale 56 • CH-1211 Geneva 20
Tel. + 41 22 749 01 11
Fax + 41 22 749 09 47
E-mail copyright@iso.org
Web www.iso.org
Published in Switzerland

ii © ISO/IEC 2012 – All rights reserved

---------------------- Page: 2 ----------------------
ISO/IEC TS 29113:2012(E)
Contents
1 Scope . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
2 Normative references . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
3 Terms and de nitions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
4 Compatibility . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
4.1 New intrinsic procedures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
4.2 Fortran 2008 compatibility . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
5 Type speci ers and attributes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
5.1 Assumed-type objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
5.2 Assumed-rank objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
5.3 ALLOCATABLE, OPTIONAL, and POINTER attributes . . . . . . . . . . . . . . . . . . . . . . 10
5.4 ASYNCHRONOUS attribute . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
5.4.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
5.4.2 Asynchronous communication . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
6 Procedures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
6.1 Characteristics of dummy data objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
6.2 Explicit interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
6.3 Argument association . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
6.4 Intrinsic procedures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
6.4.1 SHAPE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
6.4.2 SIZE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
6.4.3 UBOUND . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
7 New intrinsic procedure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
7.1 General . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
7.2 RANK (A) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
8 Interoperability with C . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
8.1 Removed restrictions on ISO C BINDING module procedures . . . . . . . . . . . . . . . . . . . . 17
8.2 C descriptors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
8.3 ISO Fortran binding.h . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
8.3.1 Summary of contents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
8.3.2 CFI dim t . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
8.3.3 CFI cdesc t . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
8.3.4 Macros and typedefs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
8.3.5 Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
8.4 Restrictions on C descriptors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
8.5 Restrictions on formal parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
8.6 Restrictions on lifetimes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
8.7 Interoperability of procedures and procedure interfaces . . . . . . . . . . . . . . . . . . . . . . . . 30
9 Required editorial changes to ISO/IEC 1539-1:2010(E) . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
9.1 General . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
9.2 Edits to Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
© ISO/IEC 2012 – All rights reserved
i

---------------------- Page: 3 ----------------------
ISO/IEC TS 29113:2012(E)
9.3 Edits to clause 1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
9.4 Edits to clause 4 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34
9.5 Edits to clause 5 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34
9.6 Edits to clause 6 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35
9.7 Edits to clause 12 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36
9.8 Edits to clause 13 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
9.9 Edits to clause 15 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
9.10 Edits to clause 16 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41
9.11 Edits to annex A . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41
9.12 Edits to annex C . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42
Annex A (informative) Extended notes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43
A.1 Clause 5 notes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43
A.1.1 Using assumed type in the context of interoperation with C . . . . . . . . . . . . . . . . 43
A.1.2 Mapping of interfaces with void * C parameters to Fortran . . . . . . . . . . . . . . . . . 43
A.1.3 Using assumed-type variables in Fortran . . . . . . . . . . . . . . . . . . . . . . . . . . . 45
A.1.4 Simplifying interfaces for arbitrary rank procedures . . . . . . . . . . . . . . . . . . . . . 46
A.2 Clause 8 notes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46
A.2.1 Dummy arguments of any type and rank . . . . . . . . . . . . . . . . . . . . . . . . . . . 46
A.2.2 Creating a contiguous copy of an array . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48
A.2.3 Changing the attributes of an array . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49
A.2.4 Creating an array section in C using CFI section . . . . . . . . . . . . . . . . . . . . . . 50
A.2.5 Use of CFI setpointer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51
A.2.6 Mapping of MPI interfaces to Fortran . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52
© ISO/IEC 2012 – All rights reserved
ii

---------------------- Page: 4 ----------------------
ISO/IEC TS 29113:2012(E)
List of Tables
8.1 Macros specifying attribute codes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
8.2 Macros specifying type codes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
8.3 Macros specifying error codes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
© ISO/IEC 2012 – All rights reserved
iii

---------------------- Page: 5 ----------------------
ISO/IEC TS 29113:2012(E)
Foreword
ISO (the International Organization for Standardization) and IEC (the International Electrotechnical Commis-
sion) form the specialized system for worldwide standardization. National bodies that are members of ISO or
IEC participate in the development of International Standards through technical committees established by the
respective organization to deal with particular elds of technical activity. ISO and IEC technical committees
collaborate in elds of mutual interest. Other international organizations, governmental and nongovernmental,
in liaison with ISO and IEC, also take part in the work. In the eld of information technology, ISO and IEC have
established a joint technical committee, ISO/IEC JTC 1.
International Standards are drafted in accordance with the rules given in the ISO/IEC Directives, Part 2.
The main task of the joint technical committee is to prepare International Standards. Draft International Stand-
ards adopted by the joint technical committee are circulated to national bodies for voting. Publication as an
International Standard requires approval by at least 75 % of the national bodies casting a vote.
In other circumstances, particularly when there is an urgent market requirement for such documents, the joint
technical committee may decide to publish an ISO/IEC Technical Speci cation (ISO/IEC TS), which represents
an agreement between the members of the joint technical committee and is accepted for publication if it is
approved by 2/3 of the members of the committee casting a vote.
An ISO/IEC TS is reviewed after three years in order to decide whether it will be con rmed for a further three
years, revised to become an International Standard, or withdrawn. If the ISO/IEC TS is con rmed, it is reviewed
again after a further three years, at which time it must either be transformed into an International Standard or
be withdrawn.
Attention is drawn to the possibility that some of the elements of this document may be the subject of patent
rights. ISO and IEC shall not be held responsible for identifying any or all such patent rights.
ISO/IEC TS 29113:2012 was prepared by Joint Technical Committee ISO/IEC JTC 1, Information technology,
Subcommittee SC22, Programming languages, their environments and system software interfaces.
© ISO/IEC 2012 – All rights reserved
iv

---------------------- Page: 6 ----------------------
ISO/IEC TS 29113:2012(E)
Introduction
The system for interoperability between the C language, as standardized by ISO/IEC 9899:1999, and Fortran, as
standardized by ISO/IEC 1539-1:2010, provides for interoperability of procedure interfaces with arguments that
are non-optional scalars, explicit-shape arrays, or assumed-size arrays. These are the cases where the Fortran
and C data concepts directly correspond. Interoperability is not provided for important cases where there is not
a direct correspondence between C and Fortran.
The existing system for interoperability does not provide for interoperability of interfaces with Fortran dummy ar-
guments that are assumed-shape arrays, have assumed character length, or have the ALLOCATABLE, POINTER,
or OPTIONAL attributes. As a consequence, a signi cant class of Fortran subprograms is not portably accessible
from C, limiting the usefulness of the facility.
The provision in the existing system for interoperability with a C formal parameter that is a pointer to void is
inconvenient to use and error-prone. C functions with such parameters are widely used.
This Technical Speci cation extends the facility of Fortran for interoperating with C to provide for interoperability
of procedure interfaces that specify dummy arguments that are assumed-shape arrays, have assumed character
length, or have the ALLOCATABLE, POINTER, or OPTIONAL attributes. New Fortran concepts of assumed
type and assumed rank are introduced. The former simpli es interoperation with formal parameters of type
(void *). The latter facilitates interoperability with C functions that can accept arguments of arbitrary rank. An
intrinsic function, RANK, is speci ed to obtain the rank of an assumed-rank variable.
The facility speci ed in this Technical Speci cation is a compatible extension of Fortran as standardized by
ISO/IEC 1539-1:2010. It does not require that any changes be made to the C language as standardized by
ISO/IEC 9899:1999.
It is the intention of ISO/IEC JTC 1/SC22 that the semantics and syntax speci ed by this Technical Speci cation
be included in the next revision of ISO/IEC 1539-1 without change unless experience in the implementation
and use of this feature identi es errors that need to be corrected, or changes are needed to achieve proper
integration, in which case every reasonable e ort will be made to minimize the impact of such changes on existing
implementations.
This Technical Speci cation is organized in 9 clauses:
Scope Clause 1
Normative references Clause 2
Terms and de nitions Clause 3
Compatibility Clause 4
Type speci ers and attributes Clause 5
Procedures Clause 6
New intrinsic procedure Clause 7
Interoperability with C Clause 8
Required editorial changes to ISO/IEC 1539-1:2010(E) Clause 9
It also contains the following nonnormative material:
Extended notes Annex A
NOTE 0.1
ISO/IEC 1539-1:2010 references ISO/IEC 9899:1999. For consistency, this Technical Speci cation also
references ISO/IEC 9899:1999, not ISO/IEC 9899:2011.
© ISO/IEC 2012 – All rights reserved
v

---------------------- Page: 7 ----------------------
TECHNICAL SPECIFICATION ISO/IEC TS 29113:2012(E)

Information technology — Further interoperability of Fortran
with C

1 Scope
This Technical Speci cation speci es the form and establishes the interpretation of facilities that extend the
Fortran language de ned by ISO/IEC 1539-1:2010. The purpose of this Technical Speci cation is to promote
portability, reliability, maintainability, and ecient execution of programs containing parts written in Fortran
and parts written in C, for use on a variety of computing systems.
© ISO/IEC 2012 – All rights reserved
1

---------------------- Page: 8 ----------------------
ISO/IEC TS 29113:2012(E)
(Blank page)
© ISO/IEC 2012 – All rights reserved
2

---------------------- Page: 9 ----------------------
ISO/IEC TS 29113:2012(E)
2 Normative references
The following referenced standards are indispensable for the application of this document. For dated references,
only the edition cited applies. For undated references, the latest edition of the referenced document (including
any amendments) applies.
ISO/IEC 1539-1:2010, Information technology|Programming languages|Fortran|Part 1:Base language
ISO/IEC 9899:1999, Programming languages|C
© ISO/IEC 2012 – All rights reserved
3

---------------------- Page: 10 ----------------------
ISO/IEC TS 29113:2012(E)
(Blank page)
© ISO/IEC 2012 – All rights reserved
4

---------------------- Page: 11 ----------------------
ISO/IEC TS 29113:2012(E)
3 Terms and de nitions
For the purposes of this document, the terms and de nitions given in ISO/IEC 1539-1:2010 and the following
apply.
3.1
assumed-rank object
dummy variable whose rank is assumed from its e ective argument
3.2
assumed-type object
dummy variable declared with the TYPE(*) type speci er
3.3
C descriptor
C structure of type CFI cdesc t
NOTE 3.1
A C descriptor is used to describe a Fortran object that has no exact analog in C.
© ISO/IEC 2012 – All rights reserved
5

---------------------- Page: 12 ----------------------
ISO/IEC TS 29113:2012(E)
(Blank page)
© ISO/IEC 2012 – All rights reserved
6

---------------------- Page: 13 ----------------------
ISO/IEC TS 29113:2012(E)
4 Compatibility
4.1 New intrinsic procedures
This Technical Speci cation de nes an intrinsic procedure in addition to those speci ed in ISO/IEC 1539-1:2010.
Therefore, a Fortran program conforming to ISO/IEC 1539-1:2010 might have a di erent interpretation under this
Technical Speci cation if it invokes an external procedure having the same name as the new intrinsic procedure,
unless that procedure is speci ed to have the EXTERNAL attribute.
4.2 Fortran 2008 compatibility
This Technical Speci cation speci es an upwardly compatible extension to ISO/IEC 1539-1:2010.
© ISO/IEC 2012 – All rights reserved
7

---------------------- Page: 14 ----------------------
ISO/IEC TS 29113:2012(E)
(Blank page)
© ISO/IEC 2012 – All rights reserved
8

---------------------- Page: 15 ----------------------
ISO/IEC TS 29113:2012(E)
5 Type speci ers and attributes
5.1 Assumed-type objects
The syntax rule R403 declaration-type-spec in subclause 4.3.1.1 of ISO/IEC 1539-1:2010 is replaced by
R403 declaration-type-spec is intrinsic-type-spec
or TYPE ( intrinsic-type-spec )
or TYPE ( derived-type-spec )
or CLASS ( derived-type-spec )
or CLASS ( * )
or TYPE ( * )
An entity declared with a declaration-type-spec of TYPE (*) is an assumed-type entity. It has no declared type
and its dynamic type and type parameters are assumed from its e ective argument. An assumed-type object is
unlimited polymorphic.
C407a An assumed-type entity shall be a dummy variable that does not have the ALLOCATABLE, CODIMEN-
SION, INTENT(OUT), POINTER, or VALUE attribute and is not an explicit-shape array.
C407b An assumed-type variable name shall not appear in a designator or expression except as an actual
argument corresponding to a dummy argument that is assumed-type, or as the rst argument to any of
the intrinsic and intrinsic module functions IS CONTIGUOUS, LBOUND, PRESENT, RANK, SHAPE,
SIZE, UBOUND, and C LOC.
C407c An assumed-type actual argument that corresponds to an assumed-rank dummy argument shall be
assumed-shape or assumed-rank.
NOTE 5.1
An assumed-type object that is not assumed-shape and not assumed-rank is intended to be passed as the
C address of the object. This means that there would be insucient information passed for an assumed-
type explicit-shape array that is an actual argument corresponding to an assumed-shape dummy argument.
Therefore TYPE(*) explicit-shape is not permitted.
NOTE 5.2
This Technical Speci cation provides no mechanism for a Fortran procedure to determine the actual type
of an assumed-type argument.
5.2 Assumed-rank objects
The syntax rule R515 array-spec in subclause 5.3.8.1 of ISO/IEC 1539-1:2010 is replaced by
R515 array-spec is explicit-shape-spec-list
or assumed-shape-spec-list
or deferred-shape-spec-list
or assumed-size-spec
or implied-shape-spec-list
or assumed-rank-spec
An assumed-rank object is a dummy variable whose rank is assumed from its e ective argument. An assumed-rank
object is declared with an array-spec that is an assumed-rank-spec.
© ISO/IEC 2012 – All rights reserved
9

---------------------- Page: 16 ----------------------
ISO/IEC TS 29113:2012(E)
R522a assumed-rank-spec is .
C535a An assumed-rank entity shall be a dummy variable that does not have the CODIMENSION or VALUE
attribute.
An assumed-rank object may have the CONTIGUOUS attribute.
C535b An assumed-rank variable name shall not appear in a designator or expression except as an actual
argument corresponding to a dummy argument that is assumed-rank, the argument of the C LOC function
in the ISO C BINDING intrinsic module, or the rst argument in a reference to an intrinsic inquiry
function.
C535c If an assumed-size or nonallocatable nonpointer assumed-rank array is an actual argument corresponding
to a dummy argument that is an INTENT(OUT) assumed-rank array, it shall not be polymorphic,
nalizable, of a type with an allocatable ultimate component, or of a type for which default initialization
is speci ed.
The de nition of TKR compatible in paragraph 2 of subclause 12.4.3.4.5 of ISO/IEC 1539-1:2010 is changed to:
A dummy argument is type, kind, and rank compatible, or TKR compatible, with another dummy
argument if the rst is type compatible with the second, the kind type parameters of the rst have
the same values as the corresponding kind type parameters of the second, and both have the same
rank or either is assumed-rank.
NOTE 5.3
The intrinsic inquiry function RANK can be used to inquire about the rank of a data object. The rank of
an assumed-rank object is zero if the rank of the corresponding actual argument is zero.
NOTE 5.4
Assumed rank is an attribute of a Fortran dummy argument. When a C function is invoked with an
actual argument that corresponds to an assumed-rank dummy argument in a Fortran interface for that C
function, the corresponding formal parameter is the address of a descriptor of type CFI cdesc t (8.7). The
rank member of the descriptor provides the rank of the actual argument. The C function should therefore
be able to handle any rank. On each invocation, the rank is available to it.
5.3 ALLOCATABLE, OPTIONAL, and POINTER attributes
The ALLOCATABLE, OPTIONAL, and POINTER attributes may be speci ed for a dummy argument in a
procedure interface that has the BIND attribute.
The constraint C1255 in subclause 12.6.2.2 of ISO/IEC 1539-1:2010 is replaced by the following three constraints.
C1255 (R1230) If proc-language-binding-spec is speci ed for a procedure, each dummy argument shall be an in-
teroperable procedure (15.3.7) or a variable that is interoperable (15.3.5, 15.3.6), assumed shape, assumed
rank, assumed type, of assumed character length, or has the ALLOCATABLE or POINTER attribute. If
proc-language-binding-spec is speci ed for a function, the function result shall be an interoperable scalar
variable.
C1255a (R1230) A dummy argument of a procedure that has a proc-language-binding-spec shall not have both
the OPTIONAL and VALUE attributes.
C1255b (R1230) A variable that is a dummy argument of a procedure that has a proc-language-binding-spec shall
be of interoperable type or assumed type.
© ISO/IEC 2012 – All rights reserved
10

---------------------- Page: 17 ----------------------
ISO/IEC TS 29113:2012(E)
The following constraint is added to subclause 5.3.6.1 of ISO/IEC 1539-1:2010.
C524a A coarray shall not be a dummy argument of a procedure that has a proc-language-binding-spec.
Constraint C516 in subclause 5.3.1 of ISO/IEC 1539-1:2010 says \The ALLOCATABLE, POINTER, or OP-
TIONAL attribute shall not be speci ed for a dummy argument of a procedure that has a proc-language-binding-
spec." This is replaced by the following, less restrictive constraint.
C516 The ALLOCATABLE or POINTER attribute shall not be speci ed for a default-initialized dummy
argument of a procedure that has a proc-language-binding-spec.
NOTE 5.5
It would be a severe burden to implementors to require that CFI allocate initialize components of an object
of a derived type with default initialization. The alternative of not requiring initialization would have been
inconsistent with the e ect of ALLOCATE in Fortran.
5.4 ASYNCHRONOUS attribute
5.4.1 Introduction
The ASYNCHRONOUS attribute is extended to apply to variables that are used for asynchronous communication.
5.4.2 Asynchronous communication
Asynchronous communication for a Fortran variable occurs through the action of procedures de ned by means
other than Fortran. It is initiated by execution of an asynchronous communication initiation procedure and
completed by execution of an asynchronous communication completion procedure. Between the execution of the
initiation and completion procedures, any variable of which any part is associated with any part of the asyn-
chronous communication variable is a pending communication a ector. Whether a procedure is an asynchronous
communication initiation or completion procedure is processor dependent.
Asynchronous communication is either input communication or output communication. For input communication,
a pending communication a ector shall not be referenced, become de ned, become unde ned, become associated
with a dummy argument that has the VALUE attribute, or have its pointer association status changed. For
output communication, a pending communication a ector shall not be rede ned, become unde ned, or have its
pointer association status changed.
NOTE 5.6
Asynchronous communication can be used for nonblocking MPI calls such as MPI IRECV and MPI ISEND.
For example,
REAL :: BUF(100,100)
... ! Code that involves BUF
BLOCK
ASYNCHRONOUS :: BUF
CALL MPI_IRECV(BUF,.REQ,.)
... ! Code that does not involve BUF
CALL MPI_WAIT(REQ,.)
END BLOCK
... ! Code that involves BUF
In this example, there is asynchronous input communication and BUF is a pending communication a ector
between the two calls. MPI IRECV may return while the communication (reading values into BUF) is still
underway. The intent is that the code between MPI IRECV and MPI WAIT executes without waiting for
this communication to complete. The restrictions are the same as for asynchronous input data transfer.
© ISO/IEC 2012 – All rights reserved
11

---------------------- Page: 18 ----------------------
ISO/IEC TS 29113:2012(E)
NOTE 5.6 (cont.)
Similar code with the call of MPI IRECV replaced by a call of MPI ISEND is asynchronous output com-
munication. The restrictions are the same as for asynchronous output data transfer.
© ISO/IEC 2012 – All rights reserved
12

---------------------- Page: 19 ----------------------
ISO/IEC TS 29113:2012(E)
6 Procedures
6.1 Characteristics of dummy data objects
Additionally to the characteristics listed in subclause 12.3.2.2 of ISO/IEC 1539-1:2010, whether the type or rank
of a dummy data object is assumed is a characteristic of the dummy data object.
6.2 Explicit interface
Additionally to the rules of subclause 12.4.2.2 of ISO/IEC 1539-1:2010, a procedure shall have an explicit interface
if it has a dummy argument that is assumed-rank.
NOTE 6.1
An explicit interface is also required for a procedure if it has a dummy argument that is assumed-type
because an assumed-type dummy argument is polymorphic.
6.3 Argument association
An assumed-rank dummy argument may correspond to an actual argument of any rank. If the actual argument
has rank zero, the dummy argument has rank zero; the shape is a zero-sized array and the LBOUND and
UBOUND intrinsic functions, with no DIM argument, return zero-sized arrays. If the actual argument has rank
greater than zero, the rank and extents of the dummy argument are assumed from the actual argument, including
the lack of a nal extent in the case of an assumed-size array. If the actual argument is an array and the dummy
argument is allocatable or a pointer, the bounds of the dummy argument are assumed from the actual argument.
An assumed-type dummy argument shall not correspond to an actual argument that is of a derived type that has
type parameters, type-bound procedures, or nal subroutines.
When a Fortran procedure that has an INTENT(OUT) allocatable dummy argument is invoked by a C function,
and the actual argument in the C function is the address of a C descriptor that describes an allocated allocatable
variable, the variable is deallocated on entry to the Fortran procedure.
When a C function is invoked from a Fortran procedure via an interface with an INTENT(OUT) allocatable
dummy argument, and the actual argument in the reference to the C function is an allocated allocatable variable,
the variable is deallocated on invocation (before execution of the C function begins).
6.4 Intrinsic procedures
6.4.1 SHAPE
The description of the intrinsic function SHAPE in ISO/IEC 1539-1:2010 is changed for an assumed-rank array
that is associated with an assumed-size array; an assumed-size array has no shape, but in this case the result has
a value equal to [ (SIZE (ARRAY, I, KIND), I=1, RANK (ARRAY)) ] with KIND omitted from SIZE if it was
omitted from SHAPE.
6.4.2 SIZE
The description of the intrinsic function SIZE in ISO/IEC 1539-1:2010 is changed in the following cases:
© ISO/IEC 2012 – All rights reserved
13

---------------------- Page: 20 ----------------------
ISO/IEC TS 29113:2012(E)
(1) for an assumed-rank object that is associated with an assumed-size array, the result has the value1
if DIM is present and equal to the rank of ARRAY, and a negative value that is equal to PRODUCT
( [ (SIZE (ARRAY, I, KIND), I=1, RANK (ARRAY)) ] ) if DIM is not present;
(2) for an assumed-rank object that is associated with a scalar, the result has the value 1.
6.4.3 UBOUND
The description of the intrinsic function UBOUND in ISO/IEC 1539-1:2010 is changed for an assumed-rank
object that is associated with an assumed-size array; the result of UBOUND (ARRAY, RANK(ARRAY), KIND)
has a value equal to LBOUND (ARRAY, RANK (ARRAY), KIND)2 with KIND omitted from LBOUND if it
was omitted from UBOUND.
NOTE 6.2
If LBOUND or UBOUND is invoked for an assumed-rank object that is associated with a scalar and DIM
is absent, the result is a zero-sized array. LBOUND or UBOUND cannot be invoked for an assumed-rank
object that is associated with a scalar if DIM is present because the rank of a scalar is zero and DIM must
be 1.
© ISO/IEC 2012 – All rights reserved
14

---------------------- Page: 21 ----------------------
ISO/IEC TS 29113:2012(E)
7 New intrinsic procedure
7.1 General
Detailed speci cation of the generic intrinsic function RANK is provided in 7.2. The types and type parameters of
the RAN
...

Questions, Comments and Discussion

Ask us and Technical Secretary will try to provide an answer. You can facilitate discussion about the standard in here.