ISO/IEC JTC 1/SC 22/WG 5/N2146
| DRAFT |
INTERNATIONAL ISO/IEC
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
PDF disclaimerThis PDF file may contain embedded typefaces. In accordance with Adobe’s licensing policy, this file may be | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
printed or viewed but shall not be edited unless the typefaces which are embedded are licensed to and installed on the computer performing the editing. In downloading this file, parties accept therein the responsibility of not infringing Adobe’s licensing policy. The ISO Central Secretariat accepts no liability in this area. Adobe is a trademark of Adobe Systems Incorporated. Details of the software products used to create this PDF file can be found in the General Info relative to the file; the PDF-creation parameters were optimized for printing. Every care has been taken to ensure that the file is suitable for use by ISO member bodies. In the unlikely event that a problem relating to it is found, please inform the Central Secretariat at the address given below. This ISO document is a Draft International Standard and is copyright-protected by ISO. Except as permitted under the applicable laws of the user’s country, neither this ISO draft nor any extract from it may be reproduced, stored in a retrieval system or transmitted in any form or by any means, electronic, photocopying, recording or otherwise, without prior written permission being secured. Requests for permission to reproduce should be addressed to either ISO at the address below or ISO’s member body in the country of the requester.
ISO copyright officeReproduction may be subject to royalty payments or a licensing agreement.  National bodies that are members of ISO or2 International Standards are drafted in accordance with the rules given in the ISO/IEC Directives, Part 2. 3 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 an4 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.5 ISO/IEC 1539-1 was prepared by Joint Technical Committee ISO/IEC JTC 1, Information technology, Subcom-
mittee SC 22, Programming languages, their environments and system software interfaces.6 This fourth edition cancels and replaces the third edition (ISO/IEC 1539-1:2010), which has been technic-
ally revised. It also incorporates the Technical Corrigenda ISO/IEC 1539-1:2010/Cor. 1:2012, ISO/IEC 1539-7 ISO/IEC 1539 consists of the following parts, under the general title Information technology — Programming
languages — Fortran:8 — Part 1: Base language 9 — Part 2: Varying length character strings
⃝c ISO/IEC 2017 – All rights reserved xvii1 This document comprises the specification of the base Fortran language, informally known as Fortran 2018.
With the limitations noted in 4.3.3, the syntax and semantics of Fortran 2008 are contained entirely within2 Fortran 2018 contains several extensions to Fortran 2008; these are listed below.
• Data declaration:
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
ISO/IEC DIS 1539-1:2017 (E)requirement, except for RANDOM_SEED. Specific names for intrinsic functions are now deemed obsoles- | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
cent. All standard procedures in the intrinsic module ISO_C_BINDING, other than C_F_POINTER, are now pure. The arguments to the intrinsic function SIGN can be of different kind. Nonpolymorphic pointer arguments to the intrinsic functions EXTENDS_TYPE_OF and SAME_TYPE_AS need not have defined pointer association status. The effects of invoking the intrinsic procedures COMMAND_ARGUMENT_- COUNT, GET_COMMAND, and GET_COMMAND_ARGUMENT, on images other than image one, are no longer processor dependent. Access to error messages from the intrinsic subroutines GET_COMMAND, GET_COMMAND_ARGUMENT, and GET_ENVIRONMENT_VARIABLE is provided by an optional ERRMSG argument. The result of NORM2 for a zero-sized array argument has been clarified. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| • Program units and procedures: | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
The IMPORT statement can appear in a contained subprogram or BLOCK construct, and can restrict• Features previously described by ISO/IEC TS 29113:2012: | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
A dummy data object can assume its rank from its effective argument. A dummy data object can assume• Changes to the intrinsic modules IEEE_ARITHMETIC, IEEE_EXCEPTIONS, and IEEE_FEATURES | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
for conformance with ISO/IEC/IEEE 60559:2011:• Features previously described by ISO/IEC TS 18508:2015: | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
The CRITICAL statement has optional ERRMSG= and STAT= specifiers. The intrinsic subroutines⃝ | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
ISO/IEC DIS 1539-1:2017 (E)3 This document is organized in 19 clauses, dealing with 8 conceptual areas. These 8 areas, and the clauses in | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
which they are treated, are:4 It also contains the following nonnormative material: | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Processor dependencies Annex A | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
ISO/IEC DIS 1539-1:2017 (E)Information technology — Programming languages — | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Fortran — Part 1: Base language 1 Scope | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1 This document specifies the form and establishes the interpretation of programs expressed in the base Fortran | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
language. The purpose of this document is to promote portability, reliability, maintainability, and efficient2 This document specifies | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
• the forms that a program written in the Fortran language may take,3 Except where stated otherwise, requirements and prohibitions specified by this document apply to programs | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
rather than processors.4 This document does not specify | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
• the mechanism by which programs are transformed for use on computing systems, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
ISO/IEC DIS 1539-1:2017 (E)
(Blank page)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
ISO/IEC DIS 1539-1:2017 (E)3.9 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
assumed-type declared with a TYPE(*) type specifier (7.3.2) 3.10 attribute property of an entity that determines its uses (8.1) 3.11 automatic data object nondummy data object with a type parameter or array bound that depends on the value of a specification-expr that is not a constant expression (8.3) 3.12 base object ⟨data-ref ⟩ object designated by the leftmost part-name (9.4.2) 3.13 binding type-bound procedure or final subroutine (7.5.5) 3.14 binding name name given to a specific or generic type-bound procedure in the type definition (7.5.5) 3.15 binding label default character value specifying the name by which a global entity with the BIND attribute is known to the companion processor (18.10.2, 18.9.2) 3.16 block sequence of executable constructs formed by the syntactic class block and which is treated as a unit by the executable constructs described in 11.1 3.17 bound array bound limit of a dimension of an array (8.5.8) 3.18 branch target statement action-stmt, associate-stmt, end-associate-stmt, if-then-stmt, end-if-stmt, select-case-stmt, end-select-stmt, select- rank-stmt, end-select-rank-stmt, select-type-stmt, end-select-type-stmt, do-stmt, end-do-stmt, block-stmt, end- block-stmt, critical-stmt, end-critical-stmt, forall-construct-stmt , where-construct-stmt, end-function-stmt, end-mp- subprogram-stmt, end-program-stmt, or end-subroutine-stmt, whose statement label appears as a label in a GO TO statement, computed GO TO statement, alt-return-spec, END= specifier, EOR= specifier, or ERR= specifier (11.2.1) 3.19 C address value identifying the location of a data object or procedure either defined by the companion processor or which might be accessible to the companion processor
NOTE 3.1
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
ISO/IEC DIS 1539-1:2017 (E)
3.20 C descriptor C structure of type CFI_cdesc_t defined in the source file ISO_Fortran_binding.h (18.4, 18.5) 3.21 character context within a character literal constant (7.4.4) or within a character string edit descriptor (13.3.2) 3.22 characteristics ⟨dummy argument⟩ being a dummy data object, dummy procedure, or an asterisk (alternate return indicator) 3.23 characteristics ⟨dummy data object⟩ properties listed in <IP_ADDRESS> 3.24 characteristics ⟨dummy procedure or dummy procedure pointer⟩ properties listed in <IP_ADDRESS> 3.25 characteristics ⟨function result⟩ properties listed in 15.3.3 3.26 characteristics ⟨procedure⟩ properties listed in 15.3.1 3.27 coarray data entity that has nonzero corank (5.4.7) 3.27.1 established coarray coarray that is accessible using an image-selector (5.4.8) 3.28 cobound bound (limit) of a codimension (8.5.6) 3.29 codimension dimension of the pattern formed by a set of corresponding coarrays (8.5.6) 3.30 coindexed object data object whose designator includes an image-selector (R924, 9.6) 3.31 collating sequence one-to-one mapping from a character set into the nonnegative integers (<IP_ADDRESS>) 3.32 common block block of physical storage specified by a COMMON statement (8.10.2) 3.32.1 blank common unnamed common block
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
ISO/IEC DIS 1539-1:2017 (E)
3.39 construct entity entity whose identifier has the scope of a construct (19.1, 19.4) 3.40 constant expression expression satisfying the requirements specified in 10.1.12, thus ensuring that its value is constant 3.41 contiguous ⟨array⟩ having array elements in order that are not separated by other data objects, as specified in 8.5.7 3.42 contiguous ⟨multi-part data object⟩ that the parts in order are not separated by other data objects 3.43 corank number of codimensions of a coarray (zero for objects that are not coarrays) (8.5.6) 3.44 cosubscript (R925) scalar integer expression in an image-selector (R924) 3.45 data entity data object, result of the evaluation of an expression, or the result of the execution of a function reference 3.46 data object object constant (7.1.4), variable (9), or subobject of a constant (<IP_ADDRESS>.3) 3.47 decimal symbol character that separates the whole and fractional parts in the decimal representation of a real number in a file (13.6) 3.48 declaration specification of attributes for various program entities
NOTE 3.23.49 default initialization mechanism for automatically initializing pointer components to have a defined pointer association status, and nonpointer components to have a particular value (<IP_ADDRESS>) 3.50 default-initialized ⟨subcomponent⟩ subject to a default initialization specified in the type definition for that component (<IP_ADDRESS>) 3.51 definable capable of definition and permitted to become defined
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
ISO/IEC DIS 1539-1:2017 (E)3.52 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
defined ⟨data object⟩ has a valid value 3.53 defined ⟨pointer⟩ has a pointer association status of associated or disassociated (<IP_ADDRESS>) 3.54 defined assignment assignment defined by a procedure (<IP_ADDRESS>, <IP_ADDRESS>.3) 3.55 defined input/output input/output defined by a procedure and accessed via a defined-io-generic-spec (R1509, <IP_ADDRESS>) 3.56 defined operation operation defined by a procedure (<IP_ADDRESS>, <IP_ADDRESS>.2) 3.57 definition ⟨data object⟩ process by which the data object becomes defined (19.6.5) 3.58 definition ⟨derived type (7.5.2), enumeration (7.6), or procedure (15.6)⟩ specification of the type, enumeration, or procedure 3.59 descendant ⟨module or submodule⟩ submodule that extends that module or submodule or that extends another descendant thereof (14.2.3) 3.60 designator name followed by zero or more component selectors, complex part selectors, array section selectors, array element selectors, image selectors, and substring selectors (9.1) 3.60.1 complex part designator designator that designates the real or imaginary part of a complex data object, independently of the other part (9.4.4) 3.60.2 object designator data object designator designator for a data object
NOTE <IP_ADDRESS> procedure designator designator for a procedure
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
ISO/IEC DIS 1539-1:2017 (E)
3.61 disassociated ⟨pointer association⟩ pointer association status of not being associated with any target and not being undefined (<IP_ADDRESS>) 3.62 disassociated ⟨pointer⟩ has a pointer association status of disassociated 3.63 dummy argument entity whose identifier appears in a dummy argument list (R1536) in a FUNCTION, SUBROUTINE, ENTRY, or statement function statement, or whose name can be used as an argument keyword in a reference to an intrinsic procedure or a procedure in an intrinsic module 3.63.1 dummy data object dummy argument that is a data object 3.63.2 dummy function dummy procedure that is a function 3.64 effective argument entity that is argument-associated with a dummy argument (<IP_ADDRESS>) 3.65 effective item scalar object resulting from the application of the rules in 12.6.3 to an input/output list 3.66 elemental independent scalar application of an action or operation to elements of an array or corresponding elements of a set of conformable arrays and scalars, or possessing the capability of elemental operation
NOTE 3.4Combination of scalar and array operands or arguments combine the scalar operand(s) with each element
3.66.1 elemental assignment assignment that operates elementally 3.66.2 elemental operation operation that operates elementally 3.66.3 elemental operator operator in an elemental operation 3.66.4 elemental procedure elemental intrinsic procedure or procedure defined by an elemental subprogram (15.8)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
ISO/IEC DIS 1539-1:2017 (E)3.66.5 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
elemental reference reference to an elemental procedure with at least one array actual argument 3.66.6 elemental subprogram subprogram with the ELEMENTAL prefix (15.8.1) 3.67 END statement
end-block-data-stmt, end-function-stmt, end-module-stmt, end-mp-subprogram-stmt, end-program-stmt,end-submodule-stmt, or end-subroutine-stmt 3.68 explicit initialization initialization of a data object by a specification statement (8.4, 8.6.7) 3.69 extent number of elements in a single dimension of an array 3.70 external file file that exists in a medium external to the program (12.3) 3.71 external unit external input/output unit entity that can be connected to an external file (12.5.3, 12.5.4) 3.72 file storage unit unit of storage in a stream file or an unformatted record file (12.3.5) 3.73 final subroutine subroutine whose name appears in a FINAL statement (7.5.6) in a type definition, and which can be automatically invoked by the processor when an object of that type is finalized (<IP_ADDRESS>) 3.74 finalizable ⟨type⟩ has a final subroutine or a nonpointer nonallocatable component of finalizable type 3.75 finalizable ⟨nonpointer data entity⟩ of finalizable type 3.76 finalization process of calling final subroutines when one of the events listed in <IP_ADDRESS> occurs 3.77 function procedure that is invoked by an expression 3.78 function result entity that returns the value of a function (<IP_ADDRESS>)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
ISO/IEC DIS 1539-1:2017 (E)
3.79 generic identifier lexical token sequence that identifies a generic set of procedures, intrinsic operations, and/or intrinsic assignments (<IP_ADDRESS>) 3.80 host instance ⟨internal procedure, or dummy procedure or procedure pointer associated with an internal procedure⟩ instance of the host procedure that supplies the host environment of the internal procedure (<IP_ADDRESS>) 3.81 host scoping unit host scoping unit immediately surrounding another scoping unit, or the scoping unit extended by a submodule 3.82 IEEE infinity ISO/IEC/IEEE 60559:2011 conformant infinite floating-point value 3.83 IEEE NaN ISO/IEC/IEEE 60559:2011 conformant floating-point datum that does not represent a number 3.84 image instance of a Fortran program (5.3.4) 3.84.1 active image image that has not failed or stopped (5.3.6) 3.84.2 failed image image that has not initiated termination but which has ceased to participate in program execution (5.3.6) 3.84.3 stopped image image that has initiated normal termination (5.3.6) 3.85 image index integer value identifying an image within a team 3.86 image control statement statement that affects the execution ordering between images (11.6) 3.87 inclusive scope nonblock scoping unit plus every block scoping unit whose host is that scoping unit or that is nested within such a block scoping unit
NOTE 3.5That is, inclusive scope is the scope as if BLOCK constructs were not scoping units.
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
ISO/IEC DIS 1539-1:2017 (E)
3.93 intrinsic type, procedure, module, assignment, operator, or input/output operation defined in this document and accessible without further definition or specification, or a procedure or module provided by a processor but not defined in this document 3.93.1 standard intrinsic ⟨procedure or module⟩ defined in this document (16) 3.93.2 nonstandard intrinsic ⟨procedure or module⟩ provided by a processor but not defined in this document 3.94 internal file character variable that is connected to an internal unit (12.4) 3.95 internal unit input/output unit that is connected to an internal file (12.5.4) 3.96 ISO 10646 character character whose representation method corresponds to UCS-4 in ISO/IEC 10646 3.97 keyword statement keyword, argument keyword, type parameter keyword, or component keyword 3.97.1 argument keyword word that identifies the corresponding dummy argument in an actual argument list (<IP_ADDRESS>) 3.97.2 component keyword word that identifies a component in a structure constructor (7.5.10) 3.97.3 statement keyword word that is part of the syntax of a statement (5.5.2) 3.97.4 type parameter keyword word that identifies a type parameter in a type parameter list 3.98 lexical token keyword, name, literal constant other than a complex literal constant, operator, label, delimiter, comma, =, =>, :, ::, ;, or % (6.2) 3.99 line sequence of zero or more characters 3.100 main program program unit that is not a subprogram, module, submodule, or block data program unit (14.1)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
ISO/IEC DIS 1539-1:2017 (E)
3.111 preconnected ⟨file or unit⟩ connected at the beginning of execution of the program (12.5.5) 3.112 procedure entity encapsulating an arbitrary sequence of actions that can be invoked directly during program execution 3.112.1 dummy procedure procedure that is a dummy argument (<IP_ADDRESS>) 3.112.2 external procedure procedure defined by an external subprogram (R503) or by means other than Fortran (15.6.3) 3.112.3 internal procedure procedure defined by an internal subprogram (R512) 3.112.4 module procedure procedure defined by a module subprogram, or a procedure provided by an intrinsic module (R1408) 3.112.5 pure procedure procedure declared or defined to be pure (15.7) 3.112.6 type-bound procedure procedure that is bound to a derived type and referenced via an object of that type (7.5.5) 3.113 processor combination of a computing system and mechanism by which programs are transformed for use on that computing system 3.114 processor dependent not completely specified in this document, having methods and semantics determined by the processor 3.115 program set of Fortran program units and entities defined by means other than Fortran that includes exactly one main program 3.116 program unit main program, external subprogram, module, submodule, or block data program unit (5.2.1) 3.117 rank number of array dimensions of a data entity (zero for a scalar entity) 3.118 record sequence of values or characters in a file (12.2)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
ISO/IEC DIS 1539-1:2017 (E)
3.126.1 character sequence type sequence type with no allocatable or pointer components, and whose components are all default character or of another character sequence type 3.126.2 numeric sequence type sequence type with no allocatable or pointer components, and whose components are all default complex, default integer, default logical, default real, double precision real, or of another numeric sequence type 3.127 shape array dimensionality of a data entity, represented as a rank-one array whose size is the rank of the data entity and whose elements are the extents of the data entity
NOTE 3.63.128 simply contiguous ⟨array designator or variable⟩ satisfying the conditions specified in 9.5.4
NOTE 3.73.129 size ⟨array⟩ total number of elements in the array 3.130 specification expression expression satisfying the requirements specified in 10.1.11, thus being suitable for use in specifications 3.131 specific name name that is not a generic name 3.132 standard-conforming program program that uses only those forms and relationships described in, and has an interpretation according to, this document 3.133 statement sequence of one or more complete or partial lines satisfying a syntax rule that ends in -stmt (6.3) 3.133.1 executable statement end-function-stmt, end-mp-subprogram-stmt, end-program-stmt, end-subroutine-stmt, or statement that is a mem- ber of the syntactic class executable-construct, excluding those in the block-specification-part of a BLOCK con- struct 3.133.2 nonexecutable statement statement that is not an executable statement
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
ISO/IEC DIS 1539-1:2017 (E)3.134 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
statement entity entity whose identifier has the scope of a statement or part of a statement (19.1, 19.4) 3.135 statement label label unsigned positive number of up to five digits that refers to an individual statement (6.2.5) 3.136 storage sequence contiguous sequence of storage units (<IP_ADDRESS>) 3.137 storage unit character storage unit, numeric storage unit, file storage unit, or unspecified storage unit (<IP_ADDRESS>) 3.137.1 character storage unit unit of storage that holds a default character value (<IP_ADDRESS>) 3.137.2 numeric storage unit unit of storage that holds a default real, default integer, or default logical value (<IP_ADDRESS>) 3.137.3 unspecified storage unit unit of storage that holds a value that is not default character, default real, double precision real, default logical, or default complex (<IP_ADDRESS>) 3.138 stream file file composed of a sequence of file storage units (12.1) 3.139 structure scalar data object of derived type (7.5) 3.139.1 structure component component of a structure 3.139.2 structure constructor syntax (structure-constructor, 7.5.10) that specifies a structure value or creates such a value 3.140 submodule program unit that extends a module or another submodule (14.2.3) 3.141 subobject portion of data object that can be referenced, and if it is a variable defined, independently of any other portion (9.4.2) 3.142 subprogram function-subprogram (R1529) or subroutine-subprogram (R1534)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
ISO/IEC DIS 1539-1:2017 (E)
3.142.1 external subprogram subprogram that is not contained in a main program, module, submodule, or another subprogram 3.142.2 internal subprogram subprogram that is contained in a main program or another subprogram 3.142.3 module subprogram subprogram that is contained in a module or submodule but is not an internal subprogram 3.143 subroutine procedure invoked by a CALL statement, by defined assignment, or by some operations on derived-type entities 3.143.1 atomic subroutine intrinsic subroutine that performs an action on its ATOM argument atomically (16.5) 3.143.2 collective subroutine intrinsic subroutine that performs a calculation on a team of images without requiring synchronization 3.144 target entity that is pointer associated with a pointer (<IP_ADDRESS>), entity on the right-hand-side of a pointer assignment statement (R1033), or entity with the TARGET attribute (8.5.17) 3.145 team ordered set of images created by execution of a FORM TEAM statement, or the initial ordered set of all images 3.145.1 current team team specified by the most recently executed CHANGE TEAM statement of a CHANGE TEAM construct that has not completed execution (11.1.5), or initial team if no CHANGE TEAM construct is being executed 3.145.2 initial team team existing at the beginning of program execution, consisting of all images 3.145.3 parent team ⟨team except for initial team⟩ current team at time of execution of the FORM TEAM statement that created the team (11.6.9) 3.145.4 team number −1 which identifies the initial team, or positive integer that identifies a team within its parent team 3.146 transformational function intrinsic function, or function in an intrinsic module, that is neither elemental nor an inquiry function
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
ISO/IEC DIS 1539-1:2017 (E)
<IP_ADDRESS> assumed type parameter length type parameter that assumes the type parameter value from another entity
NOTE <IP_ADDRESS>.2 deferred type parameter length type parameter whose value can change during execution of a program and whose type-param-value is a colon <IP_ADDRESS> kind type parameter type parameter whose value is required to be defaulted or given by a constant expression <IP_ADDRESS> length type parameter type parameter whose value is permitted to be assumed, deferred, or given by a specification expression <IP_ADDRESS> type parameter inquiry syntax (type-param-inquiry) that is used to inquire the value of a type parameter of a data object (9.4.5) <IP_ADDRESS> type parameter order ordering of the type parameters of a type (<IP_ADDRESS>) used for derived-type specifiers (derived-type-spec, 7.5.9) 3.148 ultimate argument nondummy entity with which a dummy argument is associated via a chain of argument associations (<IP_ADDRESS>) 3.149 undefined ⟨data object⟩ does not have a valid value 3.150 undefined ⟨pointer⟩ does not have a pointer association status of associated or disassociated (<IP_ADDRESS>) 3.151 unit input/output unit means, specified by an io-unit, for referring to a file (12.5.1) 3.152 unlimited polymorphic able to have any dynamic type during program execution (<IP_ADDRESS>) 3.153 unsaved not having the SAVE attribute (8.5.16)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
ISO/IEC DIS 1539-1:2017 (E)3.154 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
variable data entity that can be defined and redefined during execution of a program 3.154.1 event variable scalar variable of type EVENT_TYPE (<IP_ADDRESS>) from the intrinsic module ISO_FORTRAN_ENV 3.154.2 local variable variable in a scoping unit that is not a dummy argument or part thereof, is not a global entity or part thereof, and is not an entity or part of an entity that is accessible outside that scoping unit 3.154.3 lock variable scalar variable of type LOCK_TYPE (<IP_ADDRESS>) from the intrinsic module ISO_FORTRAN_ENV 3.154.4 team variable scalar variable of type TEAM_TYPE (<IP_ADDRESS>) from the intrinsic module ISO_FORTRAN_ENV 3.155 vector subscript section-subscript that is an array (<IP_ADDRESS>.2) 3.156 whole array array component or array name without further qualification (9.5.2)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
ISO/IEC DIS 1539-1:2017 (E)
(Blank page)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
ISO/IEC DIS 1539-1:2017 (E)or bind-stmt | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
or codimension-stmt or contiguous-stmt or dimension-stmt or external-stmt or intent-stmt or intrinsic-stmt or namelist-stmt or optional-stmt or pointer-stmt or protected-stmt or save-stmt or target-stmt or volatile-stmt or value-stmt or common-stmt or equivalence-stmt | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| R514 executable-construct | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| is action-stmt | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
or associate-construct | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
ISO/IEC DIS 1539-1:2017 (E)1 Program units are the fundamental components of a Fortran program. A program unit is a main program, an | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
external subprogram, a module, a submodule, or a block data program unit.2 A subprogram is a function subprogram or a subroutine subprogram. A module contains definitions that can be | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
made accessible to other program units. A submodule is an extension of a module; it may contain the definitions3 Each type of program unit is described in Clause 14 or 15. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
4 A program unit consists of a set of nonoverlapping scoping units.
NOTE 5.2The module or submodule containing a module subprogram is the host scoping unit of the module subpro-
any number (including zero) of external procedures, and any number (including zero) of other entities defined by1 A procedure is either a function or a subroutine. Invocation of a function in an expression causes a value to be
computed which is then used in evaluating the expression.2 A procedure that is not pure might change the program state by changing the value of accessible data objects or
procedure pointers.3 Procedures are described further in Clause 15.
38 ⃝c ISO/IEC 2017 – All rights reserved1 A module contains (or accesses from other modules) definitions that can be made accessible to other program units.
These definitions include data object declarations, type definitions, procedure definitions, and interface blocks.1 A submodule extends a module or another submodule. 2 It may provide definitions (15.6) for procedures whose interfaces are declared (<IP_ADDRESS>) in an ancestor module
or submodule. It may also contain declarations and definitions of other entities, which are accessible in its1 Each Fortran statement is classified as either an executable statement or a nonexecutable statement. 2 An executable statement is an instruction to perform or control an action. Thus, the executable statements of a
program unit determine the behavior of the program unit.3 Nonexecutable statements are used to configure the program environment in which actions take place.
5.3.2 Statement order | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
statements statements Derived-type definitions,
| FORMAT | interface blocks, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
and PARAMETER type declaration statements, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| statements | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| statements procedure declarations, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
specification statements,and statement function statements | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| statements | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| constructs | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
CONTAINS statement | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ISO/IEC DIS 1539-1:2017 (E) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1 The syntax rules of subclause 5.1 specify the statement order within program units and subprograms. These | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
rules are illustrated in Table 5.1 and Table 5.2. Table 5.1 shows the ordering rules for statements and applies1 Each program unit, module subprogram, and internal subprogram shall have exactly one END statement. The | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
end-program-stmt, end-function-stmt, end-subroutine-stmt, and end-mp-subprogram-stmt statements are execut-2 The end-module-stmt, end-submodule-stmt, and end-block-data-stmt statements are nonexecutable. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
5.3.4 Program execution1 Execution of a program consists of the asynchronous execution of a fixed number (which may be one) of its images. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Each image has its own execution state, floating-point status (17.7), and set of data objects, input/output units,2 A team is an ordered set of images that is either the initial team, consisting of all images, or a subset of a parent | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
team formed by execution of a FORM TEAM statement. The initial team has no parent; every other team has a3 During execution, each image has a current team, which is only changed by execution of CHANGE TEAM | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
and END TEAM statements. Image indices, and thus coindexing of variable names with an image-selector, are1 Following the creation of a fixed number of images, execution begins on each image. Image execution is a | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
sequence, in time, of actions. Actions take place during execution of the statement that performs them (except2 If the program contains a Fortran main program, each image begins execution with the first executable construct | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
of the main program. The execution of a main program or subprogram involves execution of the executable1 There are three image execution states: active, stopped, and failed. An image that has initiated normal termin- | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
ation of execution is a stopped image. An image that has ceased participating in program execution but has not2 A failed image remains failed for the remainder of the execution of the program. The conditions that cause an | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
image to fail are processor dependent.3 Defining a coindexed object on a failed image has no effect other than defining the stat-variable, if one appears, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
with the value STAT_FAILED_IMAGE (<IP_ADDRESS>). The value of a reference to a coindexed object on a failed4 When an image fails during the execution of a segment, a data object on a nonfailed image becomes undefined | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
if it is not a lock variable or event variable and it might be defined or become undefined by execution of a1 Termination of execution of a program is either normal termination or error termination. Normal termination | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
occurs only when all images initiate normal termination and occurs in three steps: initiation, synchronization,2 Normal termination of execution of an image is initiated when a STOP statement or end-program-stmt is executed. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Normal termination of execution of an image also may be initiated during execution of a procedure defined by a3 Error termination of execution of an image is initiated if an ERROR STOP statement is executed or as specified | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
elsewhere in this document. When error termination on an image has been initiated, the processor should initiate4 If the processor supports the concept of a process exit status, it is recommended that error termination initiated | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
other than by an ERROR STOP statement supplies a processor-dependent nonzero value as the process exit1 A type is a named categorization of data that, together with its type parameters, determines the set of values, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
syntax for denoting these values, and the set of operations that interpret and manipulate the values. This central2 A type is either an intrinsic type or a derived type. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
<IP_ADDRESS> Intrinsic type1 The intrinsic types are integer, real, complex, character, and logical. The properties of intrinsic types are described | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
in 7.4.2 All intrinsic types have a kind type parameter called KIND, which determines the representation method for the | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
specified type. The intrinsic type character also has a length type parameter called LEN, which determines the1 Derived types may be parameterized. A scalar object of derived type is a structure; assignment of structures | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
is defined intrinsically (<IP_ADDRESS>), but there are no intrinsic operations for structures. For each derived type, a2 Derived types are described further in 7.5. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
5.4.2 Data value1 Each intrinsic type has associated with it a set of values that a datum of that type may take, depending on the | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
values of the type parameters. The values for each intrinsic type are described in 7.4. The values that objects of1 A data entity has a type and type parameters; it might have a data value (an exception is an undefined variable). | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Every data entity has a rank and is thus either a scalar or an array.2 A data entity that is the result of the execution of a function reference is called the function result. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
<IP_ADDRESS> Data object1 A data object is either a constant, variable, or a subobject of a constant. The type and type parameters of a | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
named data object may be specified explicitly (8.2) or implicitly (8.7).2 Subobjects are portions of data objects that may be referenced and defined (variables only) independently of the | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
other portions.3 These include portions of arrays (array elements and array sections), portions of character strings (substrings), | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
portions of complex objects (real and imaginary parts), and portions of structures (components). Subobjects4 The following objects are referenced by a name: | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
• a named scalar (a scalar object);5 The following subobjects are referenced by an object designator: | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
• an array element (a scalar subobject); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1 A variable can have a value or be undefined; during execution of a program it can be defined, redefined, or become | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
undefined.2 A local variable of a module, submodule, main program, subprogram, or BLOCK construct is accessible only in | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
that scoping unit or construct and in any contained scoping units and constructs.1 A constant is either a named constant or a literal constant. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
2 Named constants are defined using the PARAMETER attribute (8.5.13, 8.6.11). The syntax of literal constants
is described in 7.4.1 A subobject of a constant is a portion of a constant. 2 In an object designator for a subobject of a constant, the portion referenced may depend on the value of a variable.
NOTE 5.9
1 An expression (10.1) produces a data entity when evaluated. An expression represents either a data object
reference or a computation; it is formed from operands, operators, and parentheses. The type, type parameters,1 A function reference produces a data entity when the function is executed during expression evaluation. The
type, type parameters, and rank of a function result are determined by the interface of the function (15.3.3). The1 When an object is given a valid value during program execution, it becomes defined. This is often accomplished
by execution of an assignment or input statement. When a variable does not have a predictable value, it is2 Similarly, when a pointer is associated with a target or nullified, its pointer association status becomes defined.
When the association status of a pointer is not predictable, its pointer association status is undefined.3 Clause 19 describes the ways in which variables become defined and undefined and the association status of
pointers becomes defined and undefined.1 A data object is referenced when its value is required during execution. A procedure is referenced when it is
executed.2 The appearance of a data object designator or procedure designator as an actual argument does not constitute
a reference to that data object or procedure unless such a reference is necessary to complete the specification of1 An array may have up to fifteen dimensions minus its corank, and any extent in any dimension. The size of an
array is the total number of elements, which is equal to the product of the extents. An array may have zero2 Any intrinsic operation defined for scalar objects may be applied to conformable objects. Such operations are
performed elementally to produce a resultant array conformable with the array operands. If an elemental operation3 A rank-one array may be constructed from scalars and other arrays and may be reshaped into any allowable array
shape (7.8).4 Arrays may be of any type and are described further in 9.5.
5.4.7 Coarray1 A coarray is a data entity that has nonzero corank; it can be directly referenced or defined by other images. It
may be a scalar or an array.2 For each coarray on an image, there is a corresponding coarray with the same type, type parameters, and bounds
on every other image of a team in which it is established (5.4.8).3 The set of corresponding coarrays on all images in a team is arranged in a rectangular pattern. The dimensions of
this pattern are the codimensions; the number of codimensions is the corank. The bounds for each codimension4 A coarray on any image can be accessed directly by using cosubscripts. On its own image, a coarray can also be
accessed without use of cosubscripts.5 A subobject of a coarray is a coarray if it does not have any cosubscripts, vector subscripts, allocatable component
selection, or pointer component selection.6 For a coindexed object, its cosubscript list determines the image index (9.6) in the same way that a subscript list
determines the subscript order value for an array element (<IP_ADDRESS>).7 Intrinsic procedures are provided for mapping between an image index and a list of cosubscripts.
NOTE 5.11The mechanism for an image to reference and define a coarray on another image might vary according
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
ISO/IEC DIS 1539-1:2017 (E)
NOTE 5.12Except in contexts where coindexed objects are disallowed, accessing a coarray on its own image by using
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1 A nonallocatable coarray with the SAVE attribute is established in the initial team. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
2 An allocated allocatable coarray is established in the team in which it was allocated. An unallocated allocatable
coarray is not established.3 A coarray that is an associating entity in a coarray-association of a CHANGE TEAM statement is established
in the team of its CHANGE TEAM construct.4 A nonallocatable coarray that is an associating entity in an ASSOCIATE, SELECT RANK, or SELECT TYPE
construct is established in the team in which the ASSOCIATE, SELECT RANK, or SELECT TYPE statement5 A nonallocatable coarray that is a dummy argument or host associated with a dummy argument is established
in the team in which the procedure was invoked. A coarray dummy argument is not established in any ancestor1 A pointer has an association status which is either associated, disassociated, or undefined (<IP_ADDRESS>). 2 A pointer that is not associated shall not be referenced or defined. 3 If a data pointer is an array, the rank is declared, but the bounds are determined when it is associated with a
target.1 The allocation status of an allocatable variable is either allocated or unallocated. An allocatable variable becomes
allocated as described in <IP_ADDRESS>. It becomes unallocated as described in <IP_ADDRESS>.2 An unallocated allocatable variable shall not be referenced or defined. 3 If an allocatable variable is an array, the rank is declared, but the bounds are determined when it is allocated. If
an allocatable variable is a coarray, the corank is declared, but the cobounds are determined when it is allocated.1 Many of the facilities of this document make no assumptions about the physical storage characteristics of data
objects. However, program units that include storage association dependent features shall observe the storage1 A name is used to identify a program constituent, such as a program unit, named variable, named constant,
dummy argument, or derived type.2 A designator is used to identify a program constituent or a part thereof.
5.5.2 Statement keyword1 A statement keyword is not a reserved word; that is, a name with the same spelling is allowed. In the syntax
rules, such keywords appear literally. In descriptive text, this meaning is denoted by the term “keyword” without1 Other keywords denote names that identify items in a list. In this case, items are identified by a preceding
keyword= rather than their position within the list.2 An argument keyword is the name of a dummy argument in the interface for the procedure being referenced, and
may appear in an actual argument list. A type parameter keyword is the name of a type parameter in the type1 Name association (19.5.1) permits an entity to be identified by different names in the same scoping unit or by
the same name or different names in different scoping units.2 Pointer association (19.5.2) between a pointer and a target allows the target to be denoted by the pointer. 3 Storage association (19.5.3) causes different entities to use the same storage. 4 Inheritance association (19.5.4) occurs between components of the parent component and components inherited
by type extension.1 All intrinsic types, procedures, assignments, and operators may be used in any scoping unit without further
definition or specification. Intrinsic modules (16.10, 17, 18.2) may be accessed by use association.1 This document specifies a number of intrinsic operators (e.g., the arithmetic operators +, –, *, /, and ** with
numeric operands and the logical operators .AND., .OR., etc. with logical operands). Additional operators may1 A processor has one or more companion processors. A companion processor may be a mechanism that references
and defines such entities by a means other than Fortran (15.6.3), it may be the Fortran processor itself, or it may2 If a procedure is defined by means of a companion processor that is not the Fortran processor itself, this document
refers to the C function that defines the procedure, although the procedure need not be defined by means of theISO/IEC DIS 1539-1:2017 (E)
NOTE 5.14
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
ISO/IEC DIS 1539-1:2017 (E)6 Lexical tokens and source form | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1 The processor character set is processor dependent. Each character in a processor character set is either a control | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
character or a graphic character. The set of graphic characters is further divided into letters (6.1.2), digits (6.1.3),2 The letters, digits, underscore, and special characters make up the Fortran character set. Together, the set of | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
letters, digits, and underscore define the syntax class alphanumeric-character.3 Except for the currency symbol, the graphics used for the characters shall be as given in 6.1.2, 6.1.3, 6.1.4, and | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
6.1.5. However, the style of any graphic is not specified.1 The twenty-six letters are: | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
ISO/IEC DIS 1539-1:2017 (E)1 A statement label provides a means of referring to an individual statement. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
R611 label is digit [ digit [ digit [ digit [ digit ] ] ] ]2 If a statement is labeled, the statement shall contain a nonblank character. The same statement label shall not | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
be given to more than one statement in its scope. Leading zeros are not significant in distinguishing between3 Any statement that is not part of another statement, and that is not preceded by a semicolon in fixed form, may begin | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
with a statement label, but the labels are used only in the following ways.1 A lexical token that is a delimiter is a (, ), /, [, ], (/, or /). | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
52 ⃝c ISO/IEC 2017 – All rights reserved1 A Fortran program unit is a sequence of one or more lines, organized as Fortran statements, comments, and | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
INCLUDE lines. A line is a sequence of zero or more characters. Lines following a program unit END statement2 A comment may contain any character that may occur in any character context. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
3 There are two source forms. Subclause 6.3.2 applies only to free form source. Subclause 6.3.3 applies only to fixed source
form. Free form and fixed form shall not be mixed in the same program unit. The means for specifying the source form of a program1 In free source form there are no restrictions on where a statement (or portion of a statement) may appear within
a line. A line may contain zero characters. If a line consists entirely of characters of default kind (7.4.4), it may1 In free source form blank characters shall not appear within lexical tokens other than in a character context or in
a format specification. Blanks may be inserted freely between tokens to improve readability; for example, blanks2 A blank shall be used to separate names, constants, or labels from adjacent keywords, names, constants, or labels.
NOTE 6.5 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
READ 10
30 DO K=1,3
3 One or more blanks shall be used to separate adjacent keywords except in the following cases, where blanks are
optional:Table 6.2: Adjacent keywords where separating blanks are optional
⃝c ISO/IEC 2017 – All rights reserved 53
ISO/IEC DIS 1539-1:2017 (E)
<IP_ADDRESS> Free form commentary
1 The character “!” initiates a comment except where it appears within a character context. The comment extends
to the end of the line. If the first nonblank character on a line is an “!”, the line is a comment line. Lines1 The character “&” is used to indicate that the statement is continued on the next line that is not a commentcontaining only blanks or containing no characters are also comment lines. Comments may appear anywhere in
a program unit and may precede the first statement of a program unit or follow the last statement of a program
unit. Comments have no effect on the interpretation of the program unit.
NOTE 6.6
This document does not restrict the number of consecutive comment lines.
<IP_ADDRESS> Free form statement continuation
line. Comment lines cannot be continued; an “&” in a comment has no effect. Comments may occur within a2 If a noncharacter context is to be continued, an “&” shall be the last nonblank character on the line, or the lastcontinued statement. When used for continuation, the “&” is not part of the statement. No line shall contain
a single “&” as the only nonblank character or as the only nonblank character before an “!” that initiates a
comment.
nonblank character before an “!”. There shall be a later line that is not a comment; the statement is continued3 If a lexical token is split across the end of a line, the first nonblank character on the first following noncommenton the next such line. If the first nonblank character on that line is an “&”, the statement continues at the next
character position following that “&”; otherwise, it continues with the first character position of that line.
line shall be an “&” immediately followed by the successive characters of the split token.4 If a character context is to be continued, an “&” shall be the last nonblank character on the line. There shall be
a later line that is not a comment; an “&” shall be the first nonblank character on the next such line and the1 If a statement is not continued, a comment or the end of the line terminates the statement.statement continues with the next character following that “&”.
<IP_ADDRESS> Free form statement termination
2 A statement may alternatively be terminated by a “;” character that appears other than in a character context
or in a comment. The “;” is not part of the statement. After a “;” terminator, another statement may appear1 A label may precede any statement not forming part of another statement.on the same line, or begin on that line and be continued. A sequence consisting only of zero or more blanks and
one or more “;” terminators, in any order, is equivalent to a single “;” terminator.
<IP_ADDRESS> Free form statements
NOTE 6.72 A statement shall not have more than 255 continuation lines.No Fortran statement begins with a digit.
6.3.3 Fixed source form1 In fixed source form, there are restrictions on where a statement may appear within a line. If a source line contains only characters<IP_ADDRESS> General
of default kind, it shall contain exactly 72 characters; otherwise, its maximum number of characters is processor dependent.2 Except in a character context, blanks are insignificant and may be used freely throughout the program.
54 ⃝1 The character “!” initiates a comment except where it appears within a character context or in character position 6. The commentc ISO/IEC 2017 – All rights reserved
ISO/IEC DIS 1539-1:2017 (E)
<IP_ADDRESS> Fixed form commentary
extends to the end of the line. If the first nonblank character on a line is an “!” in any character position other than character1 Except within commentary, character position 6 is used to indicate continuation. If character position 6 contains a blank or zero, theposition 6, the line is a comment line. Lines beginning with a “C” or “*” in character position 1 and lines containing only blanks are
also comment lines. Comments may appear anywhere in a program unit and may precede the first statement of the program unit or
follow the last statement of a program unit. Comments have no effect on the interpretation of the program unit.
NOTE 6.8
This document does not restrict the number of consecutive comment lines.
<IP_ADDRESS> Fixed form statement continuation
line is the initial line of a new statement, which begins in character position 7. If character position 6 contains any character other2 Comment lines cannot be continued. Comment lines may occur within a continued statement.than blank or zero, character positions 7–72 of the line constitute a continuation of the preceding noncomment line.
NOTE 6.9
An “!” or “;” in character position 6 is interpreted as a continuation indicator unless it appears within commentary indicated
by a “C” or “*” in character position 1 or by an “!” in character positions 1–5.
<IP_ADDRESS> Fixed form statement termination1 If a statement is not continued, a comment or the end of the line terminates the statement.
2 A statement may alternatively be terminated by a “;” character that appears other than in a character context, in a comment, or in
character position 6. The “;” is not part of the statement. After a “;” terminator, another statement may begin on the same line, or1 A label, if it appears, shall occur in character positions 1 through 5 of the first line of a statement; otherwise, positions 1 throughbegin on that line and be continued. A “;” shall not appear as the first nonblank character on an initial line. A sequence consisting
only of zero or more blanks and one or more “;” terminators, in any order, is equivalent to a single “;” terminator.
<IP_ADDRESS> Fixed form statements
5 shall be blank. Blanks may appear anywhere within a label. A statement following a “;” on the same line shall not be labeled.
Character positions 1 through 5 of any continuation lines shall be blank. A statement shall not have more than 255 continuation
lines. The program unit END statement shall not be continued. A statement whose initial line appears to be a program unit END
statement shall not be continued.
6.4 Including source text 1 Additional text may be incorporated into the source text of a program unit during processing. This is accomplished
with the INCLUDE line, which has the form2 The char-literal-constant shall not have a kind type parameter value that is a named-constant.INCLUDE char-literal-constant
3 An INCLUDE line is not a Fortran statement.
4 An INCLUDE line shall appear on a single source line where a statement may appear; it shall be the only
nonblank text on this line other than an optional trailing comment. Thus, a statement label is not allowed.5 The effect of the INCLUDE line is as if the referenced source text physically replaced the INCLUDE line prior
to program processing. Included text may contain any source text, including additional INCLUDE lines; such6 When an INCLUDE line is resolved, the first included statement line shall not be a continuation line and the lastnested INCLUDE lines are similarly replaced with the specified source text. The maximum depth of nesting of
any nested INCLUDE lines is processor dependent. Inclusion of the source text referenced by an INCLUDE line
shall not, at any level of nesting, result in inclusion of the same source text.
⃝c ISO/IEC 2017 – All rights reserved 55
ISO/IEC DIS 1539-1:2017 (E)
included statement line shall not be continued.7 The interpretation of char-literal-constant is processor dependent. An example of a possible valid interpretation
is that char-literal-constant is the name of a file that contains the source text to be included.1 Fortran provides an abstract means whereby data can be categorized without relying on a particular physicalNOTE 6.10
In some circumstances, for example where source code is maintained in an INCLUDE file for use in programs whose source
form might be either fixed or free, observing the following rules allows the code to be used with either source form.
• Confine statement labels to character positions 1 to 5 and statements to character positions 7 to 72.
• Treat blanks as being significant.
• Use only the exclamation mark (!) to indicate a comment, but do not start the comment in character position 6.
• For continued statements, place an ampersand (&) in both character position 73 of a continued line and character
position 6 of a continuation line.
56 ⃝c ISO/IEC 2017 – All rights reserved
ISO/IEC DIS 1539-1:2017 (E)
7 Types
7.1 Characteristics of types
7.1.1 The concept of type
representation. This abstract means is the concept of type.2 A type has a name, a set of valid values, a means to denote such values (constants), and a set of operations to
manipulate the values.1 A type is either an intrinsic type or a derived type.7.1.2 Type classification
2 This document defines five intrinsic types: integer, real, complex, character, and logical.
3 A derived type is one that is defined by a derived-type definition (7.5.2) or by an intrinsic module. It shall be
used only where it is accessible (<IP_ADDRESS>). An intrinsic type is always accessible.1 For each type, there is a set of valid values. The set of valid values for logical is completely determined by this7.1.3 Set of values
document. The sets of valid values for integer, character, and real are processor dependent. The set of valid1 The syntax for denoting a value indicates the type, type parameters, and the particular value.values for complex consists of the set of all the combinations of the values of the real and imaginary parts. The
set of valid values for a derived type is as defined in 7.5.8.
7.1.4 Constants
2 The syntax for literal constants of each intrinsic type is specified in 7.4.
3 A structure constructor (7.5.10) that is a constant expression (10.1.12) denotes a scalar constant value of derived
type. An array constructor (7.8) that is a constant expression denotes a constant array value of intrinsic or4 A constant value can be named (8.5.13, 8.6.11).derived type.
7.1.5 Operations1 For each of the intrinsic types, a set of operations and corresponding operators is defined intrinsically. These are
described in Clause 10. The intrinsic set can be augmented with operations and operators defined by functions2 For derived types, there are no intrinsic operations. Operations on derived types can be defined by the programwith the OPERATOR interface (<IP_ADDRESS>). Operator definitions are described in Clauses 10 and 15.
(7.5.11).1 A type might be parameterized. In this case, the set of values, the syntax for denoting the values, and the set of⃝c ISO/IEC 2017 – All rights reserved 57
ISO/IEC DIS 1539-1:2017 (E)
7.2 Type parameters
operations on the values of the type depend on the values of the parameters.2 A type parameter is either a kind type parameter or a length type parameter. All type parameters are of type
integer. A kind type parameter participates in generic resolution (<IP_ADDRESS>), but a length type parameter does3 Each intrinsic type has a kind type parameter named KIND. The intrinsic character type has a length typenot.
parameter named LEN. A derived type can have type parameters.4 A type parameter value may be specified by a type specification (7.4, 7.5.9).
R701 type-param-value is scalar-int-expr5 A colon as a type-param-value specifies a deferred type parameter.or *
or :
C701 (R701) The type-param-value for a kind type parameter shall be a constant expression.
C702 (R701) A colon shall not be used as a type-param-value except in the declaration of an entity that has
the POINTER or ALLOCATABLE attribute.
6 The values of the deferred type parameters of an object are determined by successful execution of an ALLOCATE
statement (9.7.1), execution of an intrinsic assignment statement (<IP_ADDRESS>), execution of a pointer assignment7 An asterisk as a type-param-value specifies that a length type parameter is an assumed type parameter. It is usedstatement (10.2.2), or by argument association (15.5.2).
NOTE 7.1
Deferred type parameters of functions, including function procedure pointers, have no values. Instead, they
indicate that those type parameters of the function result will be determined by execution of the function,
if it returns an allocated allocatable result or an associated pointer result.
for a dummy argument to assume the type parameter value from the effective argument, for an associate name1 The name of a type serves as a type specifier and may be used to declare objects of that type. A declarationin a SELECT TYPE construct to assume the type parameter value from the corresponding selector, and for a
named constant of type character to assume the character length from the constant-expr.
NOTE 7.2
The value of a kind type parameter is always known at compile time. Some parameterizations that involve
multiple representation forms need to be distinguished at compile time for practical implementation and
performance. Examples include the multiple precisions of the intrinsic real type and the possible multiple
character sets of the intrinsic character type.
The adjective “length” is used for type parameters other than kind type parameters because they often
specify a length, as for intrinsic character type. However, they can be used for other purposes. The
important difference from kind type parameters is that their values need not be known at compile time and
might change during execution.
7.3 Types, type specifiers, and values
7.3.1 Relationship of types and values to objects
specifies the type of a named object. A data object may be declared explicitly or implicitly. A data object has2 Scalar data of any intrinsic or derived type may be shaped in a rectangular pattern to compose an array of the58 ⃝c ISO/IEC 2017 – All rights reserved
ISO/IEC DIS 1539-1:2017 (E)
attributes in addition to its type. Clause 8 describes the way in which a data object is declared and how its type
and other attributes are specified.
same type and type parameters. An array object has a type and type parameters just as a scalar object does.3 A variable is a data object. The type and type parameters of a variable determine which values that variable
may take. Assignment (10.2) provides one means of changing the value of a variable of any type.4 The type of a variable determines the operations that may be used to manipulate the variable.
7.3.2 Type specifiers and type compatibility1 A type specifier specifies a type and type parameter values. It is either a type-spec or a declaration-type-spec.<IP_ADDRESS> Type specifier syntax
R702 type-spec is intrinsic-type-spec2 An intrinsic-type-spec specifies the named intrinsic type and its type parameter values. A derived-type-specor derived-type-spec
C703 (R702) The derived-type-spec shall not specify an abstract type (7.5.7).
R703 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 ( * )
C704 (R703) In a declaration-type-spec, every type-param-value that is not a colon or an asterisk shall be a
specification-expr.
C705 (R703) In a declaration-type-spec that uses the CLASS keyword, derived-type-spec shall specify an ex-
tensible type (7.5.7).
C706 (R703) TYPE(derived-type-spec) shall not specify an abstract type (7.5.7).
C707 (R702) In TYPE(intrinsic-type-spec) the intrinsic-type-spec shall not end with a comma.
C708 An entity declared with the CLASS keyword shall be a dummy argument or have the ALLOCATABLE
or POINTER attribute.
specifies the named derived type and its type parameter values.1 A TYPE type specifier is used to declare entities that are assumed-type, or of an intrinsic or derived type.NOTE 7.3
A type-spec is used in an array constructor, a SELECT TYPE construct, or an ALLOCATE statement. An
integer-type-spec is used in a DO CONCURRENT or FORALL statement. Elsewhere, a declaration-type-spec
is used.
<IP_ADDRESS> TYPE type specifier
2 A derived-type-spec in a TYPE type specifier in a type declaration statement shall specify a previously defined
derived type. If the data entity is a function result, the derived type may be specified in the FUNCTION3 An entity that is declared using the TYPE(*) type specifier is assumed-type and is an unlimited polymorphicstatement provided the derived type is defined within the body of the function or is accessible there by use or
host association. If the derived type is specified in the FUNCTION statement and is defined within the body
of the function, it is as if the function result were declared with that derived type immediately following the
derived-type-def of the specified derived type.
⃝c ISO/IEC 2017 – All rights reserved 59
ISO/IEC DIS 1539-1:2017 (E)
entity. It is not declared to have a type, and is not considered to have the same declared type as any other entity,1 The CLASS type specifier is used to declare polymorphic entities. A polymorphic entity is a data entity that isincluding another unlimited polymorphic entity. Its dynamic type and type parameters are assumed from its
effective argument.
C709 An assumed-type entity shall be a dummy data object that does not have the ALLOCATABLE, CODI-
MENSION, INTENT (OUT), POINTER, or VALUE attribute and is not an explicit-shape array.
C710 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 first argument to the
intrinsic function IS_CONTIGUOUS, LBOUND, PRESENT, RANK, SHAPE, SIZE, or UBOUND, or
the function C_LOC from the intrinsic module ISO_C_BINDING.
C711 An assumed-type actual argument that corresponds to an assumed-rank dummy argument shall be
assumed-shape or assumed-rank.
<IP_ADDRESS> CLASS type specifier
able to be of differing dynamic types during program execution.2 A derived-type-spec in a CLASS type specifier in a type declaration statement shall specify a previously defined
derived type. If the data entity is a function result, the derived type may be specified in the FUNCTION3 The declared type of a polymorphic entity is the specified type if the CLASS type specifier contains a type name.statement provided the derived type is defined within the body of the function or is accessible there by use or
host association. If the derived type is specified in the FUNCTION statement and is defined within the body
of the function, it is as if the function result were declared with that derived type immediately following its
derived-type-def .
4 An entity declared with the CLASS(*) specifier is an unlimited polymorphic entity. It is not declared to have
a type, and is not considered to have the same declared type as any other entity, including another unlimited5 A nonpolymorphic entity is type compatible only with entities of the same declared type. A polymorphic entitypolymorphic entity.
that is not an unlimited polymorphic entity is type compatible with entities of the same declared type or any ofits extensions. Even though an unlimited polymorphic entity is not considered to have a declared type, it is type
compatible with all entities. An entity is type compatible with a type if it is type compatible with entities of that
type.
NOTE 7.4
Given
...
TYPE,EXTENDS(TROOT) :: TEXTENDED
...
CLASS(TROOT) A
CLASS(TEXTENDED) B
...
A is type compatible with B but B is not type compatible with A.
6 A polymorphic allocatable object may be allocated to be of any type with which it is type compatible. A
polymorphic pointer or dummy argument may, during program execution, be associated with objects with which7 The dynamic type of an allocated allocatable polymorphic object is the type with which it was allocated. Theit is type compatible.
60 ⃝
c ISO/IEC 2017 – All rights reserved
ISO/IEC DIS 1539-1:2017 (E)
dynamic type of an associated polymorphic pointer is the dynamic type of its target. The dynamic type of a1 Each intrinsic type is classified as a numeric type or a nonnumeric type. The numeric types are integer, real, andnonallocatable nonpointer polymorphic dummy argument is the dynamic type of its effective argument. The
dynamic type of an unallocated allocatable object or a disassociated pointer is the same as its declared type. The
dynamic type of an entity identified by an associate name (11.1.3) is the dynamic type of the selector with which
it is associated. The dynamic type of an object that is not polymorphic is its declared type.
7.4 Intrinsic types
7.4.1 Classification and specification
complex. The nonnumeric intrinsic types are character and logical.2 Each intrinsic type has a kind type parameter named KIND; this type parameter is of type integer with default
kind.1 Intrinsic numeric operations are defined as specified in <IP_ADDRESS>.1 for the numeric intrinsic types. RelationalR704 intrinsic-type-spec is integer-type-spec
or REAL [ kind-selector ]
or DOUBLE PRECISION
or COMPLEX [ kind-selector ]
or CHARACTER [ char-selector ]
or LOGICAL [ kind-selector ]
R705 integer-type-spec is INTEGER [ kind-selector ]
R706 kind-selector is ( [ KIND = ] scalar-int-constant-expr )
C712 (R706) The value of scalar-int-constant-expr shall be nonnegative and shall specify a representation
method that exists on the processor.
7.4.2 Intrinsic operations on intrinsic types
intrinsic operations are defined as specified in <IP_ADDRESS> for numeric and character intrinsic types. The intrinsic1 The set of values for the integer type is a subset of the mathematical integers. The processor shall provide one orconcatenation operation is defined as specified in <IP_ADDRESS> for the character type. Logical intrinsic operations are
defined as specified in <IP_ADDRESS> for the logical type.
7.4.3 Numeric intrinsic types
<IP_ADDRESS> Integer type
more representation methods that define sets of values for data of type integer. Each such method is characterized2 The processor shall provide at least one representation method with a decimal exponent range greater than orby a value for the kind type parameter KIND. The kind type parameter of a representation method is returned
by the intrinsic function KIND (16.9.108). The decimal exponent range of a representation method is returned
by the intrinsic function RANGE (16.9.158). The intrinsic function SELECTED_INT_KIND (16.9.169) returns
a kind value based on a specified decimal exponent range requirement. The integer type includes a zero value,
which is considered to be neither negative nor positive. The value of a signed integer zero is the same as the
value of an unsigned integer zero.
equal to 18.3 The type specifier for the integer type uses the keyword INTEGER.
⃝c ISO/IEC 2017 – All rights reserved 614 The keyword INTEGER with no kind-selector specifies type integer with default kind; the kind type parameter
ISO/IEC DIS 1539-1:2017 (E)
value is equal to KIND (0). The decimal exponent range of default integer shall be at least 5.5 Any integer value may be represented as a signed-int-literal-constant.
R707 signed-int-literal-constant is [ sign ] int-literal-constant6 The optional kind type parameter following digit-string specifies the kind type parameter of the integer constant;R708 int-literal-constant is digit-string [ _ kind-param ]
R709 kind-param is digit-string
or scalar-int-constant-name
R710 signed-digit-string is [ sign ] digit-string
R711 digit-string is digit [ digit ] ...
R712 sign is +
or –
C713 (R709) A scalar-int-constant-name shall be a named constant of type integer.
C714 (R709) The value of kind-param shall be nonnegative.
C715 (R708) The value of kind-param shall specify a representation method that exists on the processor.
if it does not appear, the constant is default integer.7 An integer constant is interpreted as a decimal value.
NOTE 7.5Examples of signed integer literal constants are:
473
+56
-101
21_2
21_SHORT
1976354279568241_8
where SHORT is a scalar integer named constant. A program that uses a digit-string as a kind-param is
unlikely to be portable.
<IP_ADDRESS> Real type 1 The real type has values that approximate the mathematical real numbers. The processor shall provide two
or more approximation methods that define sets of values for data of type real. Each such method has a2 The decimal precision, decimal exponent range, and radix of an approximation method are returned by therepresentation method and is characterized by a value for the kind type parameter KIND. The kind type parameter
of an approximation method is returned by the intrinsic function KIND (16.9.108).
intrinsic functions PRECISION (16.9.151), RANGE (16.9.158), and RADIX (16.9.154). The intrinsic function3 The real type includes a zero value. Processors that distinguish between positive and negative zeros shall treatSELECTED_REAL_KIND (16.9.170) returns a kind value based on specified precision, range, and radix re-
quirements.
NOTE 7.6
See C.2.1 for remarks concerning selection of approximation methods.
62 ⃝c ISO/IEC 2017 – All rights reserved
ISO/IEC DIS 1539-1:2017 (E)
them as mathematically equivalent4 The type specifier for the real type uses the keyword REAL. The keyword DOUBLE PRECISION is an alternative• in all intrinsic relational operations, and
• as actual arguments to intrinsic procedures other than those for which it is explicitly specified that negative
zero is distinguished.
NOTE 7.7
On a processor that distinguishes between 0.0 and −0.0,
( X >= 0.0 )
evaluates to true if X = 0.0 or if X = −0.0,
( X < 0.0 )
evaluates to false for X = −0.0.
In order to distinguish between 0.0 and −0.0, a program can use the intrinsic function SIGN. SIGN (1.0, X)
will return −1.0 if X < 0.0 or if the processor distinguishes between 0.0 and −0.0 and X has the value −0.0.
specifier for one kind of real type.5 If the type keyword REAL is used without a kind type parameter, the real type with default real kind is specified
and the kind value is KIND (0.0). The type specifier DOUBLE PRECISION specifies type real with double6 The decimal precision of double precision real shall be at least 10, and its decimal exponent range shall be atprecision kind; the kind value is KIND (0.0D0). The decimal precision of the double precision real approximation
method shall be greater than that of the default real method.
least 37. It is recommended that the decimal precision of default real be at least 6, and that its decimal exponent7 A real literal constant without a kind type parameter is a default real constant if it is without an exponent partrange be at least 37.
R713 signed-real-literal-constant is [ sign ] real-literal-constant
R714 real-literal-constant is significand [ exponent-letter exponent ] [ _ kind-param ]
or digit-string exponent-letter exponent [ _ kind-param ]
R715 significand is digit-string . [ digit-string ]
or . digit-string
R716 exponent-letter is E
or D
R717 exponent is signed-digit-string
C716 (R714) If both kind-param and exponent-letter appear, exponent-letter shall be E.
C717 (R714) The value of kind-param shall specify an approximation method that exists on the processor.
or has exponent letter E, and is a double precision real constant if it has exponent letter D. A real literal constant8 The exponent represents the power of ten scaling to be applied to the significand or digit string. The meaning ofwritten with a kind type parameter is a real constant with the specified kind type parameter.
these constants is as in decimal scientific notation.9 The significand may be written with more digits than a processor will use to approximate the value of the constant.
⃝c ISO/IEC 2017 – All rights reserved 631 The complex type has values that approximate the mathematical complex numbers. The values of a complex
ISO/IEC DIS 1539-1:2017 (E)
NOTE 7.8
Examples of signed real literal constants are:
-12.78
+1.6E3
2.1
-16.E4_8
0.45D-4
10.93E7_QUAD
.123
3E4
where QUAD is a scalar integer named constant.
<IP_ADDRESS> Complex type
type are ordered pairs of real values. The first real value is called the real part, and the second real value is called2 Each approximation method used to represent data entities of type real shall be available for both the real andthe imaginary part.
imaginary parts of a data entity of type complex. The (default integer) kind type parameter KIND for a complex3 The type specifier for the complex type uses the keyword COMPLEX. There is no keyword for double precisionentity specifies for both parts the real approximation method characterized by this kind type parameter value.
The kind type parameter of an approximation method is returned by the intrinsic function KIND (16.9.108).
complex. If the type keyword COMPLEX is used without a kind type parameter, the complex type with default4 If the real part and the imaginary part of a complex literal constant are both real, the kind type parameter valuecomplex kind is specified, the kind value is KIND (0.0), and both parts are default real.
R718 complex-literal-constant is ( real-part , imag-part )
R719 real-part is signed-int-literal-constant
or signed-real-literal-constant
or named-constant
R720 imag-part is signed-int-literal-constant
or signed-real-literal-constant
or named-constant
C718 (R718) Each named constant in a complex literal constant shall be of type integer or real.
of the complex literal constant is the kind type parameter value of the part with the greater decimal precision; if5 If both the real and imaginary parts are integer, they are converted to the default real approximation methodthe precisions are the same, it is the kind type parameter value of one of the parts as determined by the processor.
If a part has a kind type parameter value different from that of the complex literal constant, the part is converted
to the approximation method of the complex literal constant.
and the constant is default complex. If only one of the parts is an integer, it is converted to the approximation1 The character type has a set of values composed of character strings. A character string is a sequence of characters,method selected for the part that is real and the kind type parameter value of the complex literal constant is
that of the part that is real.
NOTE 7.9
Examples of complex literal constants are:
64 ⃝c ISO/IEC 2017 – All rights reserved
ISO/IEC DIS 1539-1:2017 (E)
NOTE 7.9 (cont.)
(1.0, -1.0)
(3, 3.1E6)
(4.0_4, 3.6E7_8)
( 0., PI) ! where PI is a previously declared named real constant.
7.4.4 Character type
<IP_ADDRESS> Character sets
numbered from left to right 1, 2, 3, ... up to the number of characters in the string. The number of characters in2 The processor shall provide one or more representation methods that define sets of values for data of typethe string is called the length of the string. The length is a type parameter; its kind is processor dependent and
its value is greater than or equal to zero.
character. Each such method is characterized by a value for the (default integer) kind type parameter KIND.3 The character set specified in ISO/IEC 646:1991 (International Reference Version) is referred to as the ASCIIThe kind type parameter of a representation method is returned by the intrinsic function KIND (16.9.108). The
intrinsic function SELECTED_CHAR_KIND (16.9.168) returns a kind value based on the name of a character
type. Any character of a particular representation method representable in the processor may occur in a character
string of that representation method.
character set and its corresponding representation method is ASCII character kind. The character set UCS-4 as1 The type specifier for the character type uses the keyword CHARACTER.specified in ISO/IEC 10646 is referred to as the ISO 10646 character set and its corresponding representation
method is the ISO 10646 character kind.
<IP_ADDRESS> Character type specifier
2 If the type keyword CHARACTER is used without a kind type parameter, the character type with default
character kind is specified and the kind value is KIND (’A’).3 The default character kind shall support a character set that includes the characters in the Fortran character
set (6.1). By supplying nondefault character kinds, the processor may support additional character sets. The4 The char-selector in a CHARACTER intrinsic-type-spec and the * char-length in an entity-decl or in a component-characters available in nondefault character kinds are not specified by this document, except that one character
in each nondefault character set shall be designated as a blank character to be used as a padding character.
R721 char-selector is length-selector
or ( LEN = type-param-value ,
KIND = scalar-int-constant-expr )
or ( type-param-value ,
[ KIND = ] scalar-int-constant-expr )
or ( KIND = scalar-int-constant-expr
[ , LEN =type-param-value ] )
R722 length-selector is ( [ LEN = ] type-param-value )
or * char-length [ , ]
R723 char-length is ( type-param-value )
or int-literal-constant
C719 (R721) The value of scalar-int-constant-expr shall be nonnegative and shall specify a representation
method that exists on the processor.
C720 (R723) The int-literal-constant shall not include a kind-param.
⃝c ISO/IEC 2017 – All rights reserved 65
ISO/IEC DIS 1539-1:2017 (E)
C721 (R723) A type-param-value in a char-length shall be a colon, asterisk, or specification-expr.
C722 (R721 R722 R723) A type-param-value of * shall be used only
• to declare a dummy argument,
• to declare a named constant,
• in the type-spec of an ALLOCATE statement wherein each allocate-object is a dummy argument of
type CHARACTER with an assumed character length,
• in the type-spec or derived-type-spec of a type guard statement (11.1.11), or
• in an external function, to declare the character length parameter of the function result.
C723 A function name shall not be declared with an asterisk type-param-value unless it is of type CHARACTER
and is the name of a dummy function or the name of the result of an external function.
C724 A function name declared with an asterisk type-param-value shall not be an array, a pointer, elemental, or pure. A function
name declared with an asterisk type-param-value shall not have the RECURSIVE attribute.
C725 (R722) The optional comma in a length-selector is permitted only in a declaration-type-spec in a type-declaration-stmt.
C726 (R722) The optional comma in a length-selector is permitted only if no double-colon separator appears in the type-
declaration-stmt.
C727 (R721) The length specified for a character statement function or for a statement function dummy argument of type
character shall be a constant expression.
decl of a type definition specify character length. The * char-length in an entity-decl or a component-decl specifies5 If the character length parameter value evaluates to a negative value, the length of character entities declaredan individual length and overrides the length specified in the char-selector, if any. If a * char-length is not specified
in an entity-decl or a component-decl, the length-selector or type-param-value specified in the char-selector is the
character length. If the length is not specified in a char-selector or a * char-length, the length is 1.
is zero. A character length parameter value of : indicates a deferred type parameter (7.2). A char-length type1 The syntax of a character literal constant is given by R724.parameter value of * has the following meanings.
• If used to declare a dummy argument of a procedure, the dummy argument assumes its length from its
effective argument.
• If used to declare a named constant, the length is that of the constant value.
• If used in the type-spec of an ALLOCATE statement, each allocate-object assumes its length from its effective
argument.
• If used in the type-spec of a type guard statement, the associating entity assumes its length from the selector.
• If used to specify the character length parameter of a function result, any scoping unit invoking the function or passing it as
an actual argument shall declare the function name with a character length parameter value other than * or access such a
definition by argument, host, or use association. When the function is invoked, the length of the function result is assumed
from the value of this type parameter.
<IP_ADDRESS> Character literal constant
R724 char-literal-constant is [ kind-param _ ] ’ [ rep-char ] ... ’2 The optional kind type parameter preceding the leading delimiter specifies the kind type parameter of the char-or [ kind-param _ ] " [ rep-char ] ... "
C728 (R724) The value of kind-param shall specify a representation method that exists on the processor.
acter constant; if it does not appear, the constant is default character.3 For the type character with kind kind-param, if it appears, and for default character otherwise, a representable66 ⃝c ISO/IEC 2017 – All rights reserved
ISO/IEC DIS 1539-1:2017 (E)
character, rep-char, is defined as follows.4 The delimiting apostrophes or quotation marks are not part of the value of the character literal constant.• In free source form, it is any graphic character in the processor-dependent character set.
• In fixed source form, it is any character in the processor-dependent character set. A processor may restrict the occurrence of
some or all of the control characters.
5 An apostrophe character within a character constant delimited by apostrophes is represented by two consecutive
apostrophes (without intervening blanks); in this case, the two apostrophes are counted as one character. Sim-6 A zero-length character literal constant is represented by two consecutive apostrophes (without intervening blanks)ilarly, a quotation mark character within a character constant delimited by quotation marks is represented by
two consecutive quotation marks (without intervening blanks) and the two quotation marks are counted as one
character.
or two consecutive quotation marks (without intervening blanks) outside of a character context.1 The processor defines a collating sequence for the character set of each kind of character. The collating sequenceNOTE 7.10
Examples of character literal constants are:
"DON’T"
’DON’’T’
both of which have the value DON’T and
’’
which has the zero-length character string as its value.
NOTE 7.11
An example of a nondefault character literal constant, where the processor supports the corresponding
character set, is:
NIHONGO_’ ’
where NIHONGO is a named constant whose value is the kind type parameter for Nihongo (Japanese)
characters. This means “Without her, nothing is possible”.
<IP_ADDRESS> Collating sequence
is an isomorphism between the character set and the set of integers {I : 0 ≤ I < N }, where N is the number of2 The collating sequence of the default character kind shall satisfy the following constraints.characters in the set. The intrinsic functions CHAR (16.9.44) and ICHAR (16.9.95) provide conversions between
the characters and the integers according to this mapping.
NOTE 7.12
For example:
ICHAR ( ’X’ )
returns the integer value of the character ’X’ according to the collating sequence of the processor.
• ICHAR (’A’) < ICHAR (’B’) < ... < ICHAR (’Z’) for the twenty-six upper-case letters.
⃝c ISO/IEC 2017 – All rights reserved 67
ISO/IEC DIS 1539-1:2017 (E)
• ICHAR (’0’) < ICHAR (’1’) < ... < ICHAR (’9’) for the ten digits.3 There are no constraints on the location of any other character in the collating sequence, nor is there any specified• ICHAR (’ ’) < ICHAR (’0’) < ICHAR (’9’) < ICHAR (’A’) or
ICHAR (’ ’) < ICHAR (’A’) < ICHAR (’Z’) < ICHAR (’0’).
• ICHAR (’a’) < ICHAR (’b’) < ... < ICHAR (’z’) for the twenty-six lower-case letters.
• ICHAR (’ ’) < ICHAR (’0’) < ICHAR (’9’) < ICHAR (’a’) or
ICHAR (’ ’) < ICHAR (’a’) < ICHAR (’z’) < ICHAR (’0’).
collating sequence relationship between the upper-case and lower-case letters.4 The collating sequence for the ASCII character kind is as specified in ISO/IEC 646:1991 (International Reference
Version); this collating sequence is called the ASCII collating sequence in this document. The collating sequence5 The intrinsic functions LGT, LGE, LLE, and LLT (16.9.114-16.9.117) provide comparisons between strings basedfor the ISO 10646 character kind is as specified in ISO/IEC 10646.
NOTE 7.13
The intrinsic functions ACHAR (16.9.3) and IACHAR (16.9.88) provide conversions between characters
and corresponding integer values according to the ASCII collating sequence.
on the ASCII collating sequence. International portability is guaranteed if the set of characters used is limited1 The logical type has two values, which represent true and false.to the Fortran character set (6.1).
7.4.5 Logical type
2 The processor shall provide one or more representation methods for data of type logical. Each such method
is characterized by a value for the (default integer) kind type parameter KIND. The kind type parameter of a3 The type specifier for the logical type uses the keyword LOGICAL.representation method is returned by the intrinsic function KIND (16.9.108).
4 The keyword LOGICAL with no kind-selector specifies type logical with default kind; the kind type parameter
value is equal to KIND (.FALSE.).5 The optional kind type parameter specifies the kind type parameter of the logical constant; if it does not appear,R725 logical-literal-constant is .TRUE. [ _ kind-param ]
or .FALSE. [ _ kind-param ]
C729 (R725) The value of kind-param shall specify a representation method that exists on the processor.
the constant has the default logical kind.1 Additional types can be derived from the intrinsic types and other derived types. A type definition defines the7.5 Derived types
7.5.1 Derived type concepts
name of the type and the names and attributes of its components and type-bound procedures.2 A derived type can be parameterized by one or more type parameters, each of which is defined to be either a
kind or length type parameter and can have a default value.3 The ultimate components of a derived type are the components that are of intrinsic type or have the ALLOC-
ATABLE or POINTER attribute, plus the ultimate components of the components that are of derived type and4 The direct components of a derived type are the components of that type, plus the direct components of thehave neither the ALLOCATABLE nor POINTER attribute.
68 ⃝
c ISO/IEC 2017 – All rights reserved
ISO/IEC DIS 1539-1:2017 (E)
components that are of derived type and have neither the ALLOCATABLE nor POINTER attribute.5 The potential subobject components of a derived type are the nonpointer components of that type together with
the potential subobject components of the nonpointer components that are of derived type. This includes all the6 The components, direct components, potential subobject components, and ultimate components of an object ofcomponents that could be a subobject of an object of the type (9.4.2).
derived type are the components, direct components, potential subobject components, and ultimate components7 By default, no storage sequence is implied by the order of the component definitions. However, a storage sequenceof its type, respectively.
is implied for a sequence type (<IP_ADDRESS>). If the derived type has the BIND attribute, the storage sequence is that8 A scalar entity of derived type is a structure. If a derived type has the SEQUENCE attribute, a scalar entity ofrequired by the companion processor (5.5.7, 18.3.4).
the type is a sequence structure.1 Derived types with the BIND attribute are subject to additional constraints as specified in 18.3.4.NOTE 7.14
The ultimate components of an object of the derived type kids defined below are oldest_child%name,
oldest_child%age, and other_kids. The direct components of such an object are oldest_child%name,
oldest_child%age, other_kids, and oldest_child.
type :: person
character(len=20) :: name
integer :: age
end type person
type :: kids
type(person) :: oldest_child
type(person), allocatable, dimension(:) :: other_kids
end type kids
7.5.2 Derived-type definition
<IP_ADDRESS> Syntax of a derived-type definition
R726 derived-type-def is derived-type-stmt
[ type-param-def-stmt ] ...
[ private-or-sequence ] ...
[ component-part ]
[ type-bound-procedure-part ]
end-type-stmt
R727 derived-type-stmt is TYPE [ [ , type-attr-spec-list ] :: ] type-name
[ ( type-param-name-list ) ]
R728 type-attr-spec is ABSTRACT
or access-spec
or BIND (C)
or EXTENDS ( parent-type-name )
C730 (R727) A derived type type-name shall not be DOUBLEPRECISION or the same as the name of any
intrinsic type defined in this document.
C731 (R727) The same type-attr-spec shall not appear more than once in a given derived-type-stmt.
C732 The same type-param-name shall not appear more than once in a given derived-type-stmt.
⃝c ISO/IEC 2017 – All rights reserved 69
ISO/IEC DIS 1539-1:2017 (E)
C733 (R728) A parent-type-name shall be the name of a previously defined extensible type (7.5.7).
C734 (R726) If the type definition contains or inherits (<IP_ADDRESS>) a deferred type-bound procedure (7.5.5), AB-
STRACT shall appear.
C735 (R726) If ABSTRACT appears, the type shall be extensible.
C736 (R726) If EXTENDS appears, SEQUENCE shall not appear.
C737 (R726) If EXTENDS appears and the type being defined has a coarray ultimate component, its parent
type shall have a coarray ultimate component.
C738 (R726) If EXTENDS appears and the type being defined has a potential subobject component of type
EVENT_TYPE or LOCK_TYPE from the intrinsic module ISO_FORTRAN_ENV, its parent type
shall be EVENT_TYPE or LOCK_TYPE or have a potential subobject component of type EVENT_-
TYPE or LOCK_TYPE.
R729 private-or-sequence is private-components-stmt
or sequence-stmt
C739 (R726) The same private-or-sequence shall not appear more than once in a given derived-type-def .
R730 end-type-stmt is END TYPE [ type-name ]
C740 (R730) If END TYPE is followed by a type-name, the type-name shall be the same as that in the
corresponding derived-type-stmt.
NOTE 7.15An example of a derived-type definition is:
CHARACTER (LEN = 50) NAME
An example of declaring a variable CHAIRMAN of type PERSON is:
TYPE (PERSON) :: CHAIRMAN
| <IP_ADDRESS> |
Accessibility
1 The accessibility of a type name is determined as specified in 8.5.2. The accessibility of a type name does not
affect, and is not affected by, the accessibility of its components and type-bound procedures.2 If a derived type is defined in the scoping unit of a module, and its name is private in that module, then the type
name, and thus the structure constructor (7.5.10) for the type, are accessible only within that module and its |
Such a type would be accessible only within the module in which it is defined, and within its descendants.
| 70 | |||||||
c ISO/IEC 2017 – All rights reserved | |||||||
be declared to be of an intrinsic type or of a sequence type, the derived type shall not have any type1 If the SEQUENCE statement appears, the type has the SEQUENCE attribute and is a sequence type. The order
of the component definitions in a sequence type specifies a storage sequence for objects of that type. The type | |||||||
INTEGER :: INT_VAL
LOGICAL :: LOG_VAL
REAL :: REAL_VAL
NOTE 7.18
A structure resolves into a sequence of components. Unless the structure includes a SEQUENCE statement,
the use of this terminology in no way implies that these components are stored in this, or any other, order.
Nor is there any requirement that contiguous storage be used. The sequence merely refers to the fact that
in writing the definitions there will necessarily be an order in which the components appear, and this will
define a sequence of components. This order is of limited significance because a component of an object of
derived type will always be accessed by a component name except in the following contexts: the sequence of
expressions in a derived-type value constructor, intrinsic assignment, the data values in namelist input data,
and the inclusion of the structure in an input/output list of a formatted data transfer, where it is expanded
to this sequence of components. Provided the processor adheres to the defined order in these cases, it is
otherwise free to organize the storage of the components for any nonsequence structure in memory as best
suited to the particular architecture.
| <IP_ADDRESS> |
Determination of derived types
1 Derived-type definitions with the same type name may appear in different scoping units, in which case they might
be independent and describe different derived types or they might describe the same type.2 Two data entities have the same type if they are declared with reference to the same derived-type definition. Data
entities also have the same type if they are declared with reference to different derived-type definitions that specify |
REAL X,
| ⃝c ISO/IEC 2017 – All rights reserved | |
| 71 | |
|
| |
|
ISO/IEC DIS 1539-1:2017 (E)
NOTE 7.19 (cont.) | |
TYPE (POINT) :: X1
CALL SUB (X1)
...
SUBROUTINE SUB (A)
TYPE (POINT) :: A...
The definition of derived type POINT is known in subroutine SUB by host association. Because the
declarations of X1 and A both reference the same derived-type definition, X1 and A have the same type.
X1 and A also would have the same type if the derived-type definition were in a module and both SUB and
its containing program unit accessed that derived type from the module.
NOTE 7.20
An example of data entities in different scoping units having the same type is:
CHARACTER (50) NAME
TYPE (EMPLOYEE) PROGRAMMER
CALL SUB (PROGRAMMER)
...
SUBROUTINE SUB (POSITION)
CHARACTER (50) NAME
TYPE (EMPLOYEE) POSITION
...
The actual argument PROGRAMMER and the dummy argument POSITION have the same type because
they are declared with reference to a derived-type definition with the same name, the SEQUENCE attribute,
and components that agree in order, name, and attributes.
Suppose the component name ID_NUMBER was ID_NUM in the subroutine. Because all the component
names are not identical to the component names in derived type EMPLOYEE in the main program, the
actual argument PROGRAMMER would not be of the same type as the dummy argument POSITION.
Thus, the program would not be standard-conforming.
NOTE 7.21
The requirement that the two types have the same name applies to the type-names in the respective derived
type definitions, not to local names introduced via renaming in USE statements.
| 72 | ⃝c ISO/IEC 2017 – All rights reserved | ||||||||||||||||||||
|
ISO/IEC DIS 1539-1:2017 (E) | |||||||||||||||||||||
or LEN1 The derived type is parameterized if the derived-type-stmt has any type-param-names. | |||||||||||||||||||||
| 2 Each type parameter is itself of type integer. If its kind selector is omitted, the kind type parameter is default | |||||||||||||||||||||
integer.3 The type-param-attr-spec explicitly specifies whether a type parameter is a kind parameter or a length parameter. | |||||||||||||||||||||
|
4 If a type-param-decl has a scalar-int-constant-expr, the type parameter has a default value which is specified by
the expression. If necessary, the value is converted according to the rules of intrinsic assignment (<IP_ADDRESS>) to a5 A type parameter may be used as a primary in a specification expression (10.1.11) in the derived-type-def . A
kind type parameter may also be used as a primary in a constant expression (10.1.12) in the derived-type-def . | |||||||||||||||||||||
In the following example, dim is declared to be a kind parameter, allowing generic overloading of procedures
distinguished only by dim.
TYPE general_point(dim)INTEGER, KIND :: dim
REAL :: coordinates(dim)
<IP_ADDRESS> Type parameter order
1 Type parameter order is an ordering of the type parameters of a derived type; it is used for derived-type specifiers.
2 The type parameter order of a nonextended type is the order of the type parameter list in the derived-type
definition. The type parameter order of an extended type (7.5.7) consists of the type parameter order of itsISO/IEC DIS 1539-1:2017 (E)parent type followed by any additional type parameters in the order of the type parameter list in the derived-type
definition.
⃝c ISO/IEC 2017 – All rights reserved 73
NOTE 7.23Given
TYPE :: t1 (k1, k2)
INTEGER, KIND :: k1, k2
REAL (k1) a (k2)
TYPE, EXTENDS(t1) :: t2 (k3)
INTEGER, KIND :: k3LOGICAL (k3) flag
the type parameter order for type t1 is k1 then k2, and the type parameter order for type t2 is k1 then k2
then k3.
| 7.5.4 |
Components
ponents in the component-decl-list, except that the character length parameter may be specified or overridden1 A data component is an array if its component-decl contains a component-array-spec or its data-component-def-
stmt contains a DIMENSION clause. If the component-decl contains a component-array-spec, it specifies the | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
REAL, DIMENSION (2, 2) :: COORD ! COORD(:,1) has the value of [X1, Y1]! COORD(:,2) has the value of [X2, Y2]
REAL :: WIDTH ! Line width in centimeters INTEGER :: PATTERN ! 1 for solid, 2 for dash, 3 for dot
An example of declaring a variable LINE_SEGMENT to be of the type LINE is:
The scalar variable LINE_SEGMENT has a component that is an array. In this case, the array is a
TYPE (LINE) :: LINE_SEGMENT subobject of a scalar. The double colon in the definition for COORD is required; the double colon in the
definition for WIDTH and PATTERN is optional.
NOTE 7.27
An example of a derived type definition with an allocatable component is:
INTEGER, ALLOCATABLE :: CONTENTS (:)
INTEGER :: INDEX
For each scalar variable of type STACK, the shape of the component CONTENTS is determined by execu-
tion of an ALLOCATE statement or assignment statement, or by argument association.
NOTE 7.28
Default initialization of an explicit-shape array component can be specified by a constant expression con-
sisting of an array constructor (7.8), or of a single scalar that becomes the value of each array element.
| <IP_ADDRESS> |
Coarray components
1 A data component is a coarray if its component-decl contains a coarray-spec or its data-component-def-stmt
contains a CODIMENSION clause. If the component-decl contains a coarray-spec it specifies the corank; otherwise, |
REAL, ALLOCATABLE, CODIMENSION [:, :, :] :: GRID (:, :, :)
An object of type grid_type cannot be an array, an allocatable object, a coarray, or a pointer.
| 76 | ⃝c ISO/IEC 2017 – All rights reserved | ||
|
ISO/IEC DIS 1539-1:2017 (E) | |||
| |||
pointer component has the POINTER keyword in its proc-component-attr-spec-list.NOTE 7.30
An example of a derived type definition with a pointer component is:
INTEGER :: VOLUME, YEAR, PAGE CHARACTER (LEN = 50) :: TITLE PROCEDURE (printer_interface), POINTER :: PRINT => NULL() CHARACTER, DIMENSION (:), POINTER :: SYNOPSIS
Any object of type REFERENCE will have the four nonpointer components VOLUME, YEAR, PAGE, and
TITLE, the procedure pointer PRINT, which has an explicit interface the same as printer_interface, plus
a pointer to an array of characters holding SYNOPSIS. The size of this target array will be determined by
the length of the synopsis. The space for the target could be allocated (9.7.1) or the pointer component
could be associated with a target by a pointer assignment statement (10.2.2).
| <IP_ADDRESS> |
The passed-object dummy argument
1 A passed-object dummy argument is a distinguished dummy argument of a procedure pointer component or
type-bound procedure (7.5.5). It affects procedure overriding (<IP_ADDRESS>) and argument association (<IP_ADDRESS>).2 If NOPASS is specified, the procedure pointer component or type-bound procedure has no passed-object dummy
argument.3 If neither PASS nor NOPASS is specified or PASS is specified without arg-name, the first dummy argument of a
procedure pointer component or type-bound procedure is its passed-object dummy argument.4 If PASS (arg-name) is specified, the dummy argument named arg-name is the passed-object dummy argument of
the procedure pointer component or named type-bound procedure.1 Default initialization provides a means of automatically initializing pointer components to be disassociated or
associated with specific targets, and nonpointer nonallocatable components to have a particular value. Allocatable2 A pointer variable or component is data-pointer-initialization compatible with a target if the pointer is type
compatible with the target, they have the same rank, all nondeferred type parameters of the pointer have the3 If null-init appears for a pointer component, that component in any object of the type has an initial association
status of disassociated (3.61) or becomes disassociated as specified in <IP_ADDRESS>.4 If initial-data-target appears for a data pointer component, that component in any object of the type is initially
associated with the target or becomes associated with the target as specified in <IP_ADDRESS>.5 If initial-proc-target (<IP_ADDRESS>) appears in proc-decl for a procedure pointer component, that component in any
object of the type is initially associated with the target or becomes associated with the target as specified in6 If constant-expr appears for a nonpointer component, that component in any object of the type is initially defined
(19.6.3) or becomes defined as specified in 19.6.5 with the value determined from constant-expr. If necessary,7 A subcomponent (9.4.2) is default-initialized if the type of the object of which it is a component specifies default
initialization for that component, and the subcomponent is not a subobject of an object that is default-initialized8 A type has default initialization if component-initialization is specified for any direct component of the type. An
object has default initialization if it is of a type that has default initialization. |
CHARACTER (LEN = 5) MONTH
INTEGER :: YEAR = 2008 ! Partial default initialization
In the following example, the default initial value for the YEAR component of TODAY is overridden by
explicit initialization in the type declaration statement:
TYPE (DATE), PARAMETER :: TODAY = DATE (21, "Feb.", 2009)
| 78 | ⃝c ISO/IEC 2017 – All rights reserved |
|
ISO/IEC DIS 1539-1:2017 (E)NOTE 7.33 | |
|
The default initial value of a component of derived type can be overridden by default initialization specified in the definition of the type. Continuing the example of NOTE 7.32: | |
TYPE(DATE) :: PLAY_DAY = TODAY
TYPE(SINGLE_SCORE), POINTER :: NEXT => NULL ( )
TYPE(SINGLE_SCORE) SETUP
The PLAY_DAY component of SETUP receives its initial value from TODAY, overriding the initialization
for the YEAR component.
NOTE 7.34
Arrays of structures can be declared with elements that are partially or totally initialized by default.
Continuing the example of NOTE 7.33 :
TYPE MEMBER (NAME_LEN)INTEGER, LEN :: NAME_LEN
CHARACTER (LEN = NAME_LEN) :: NAME = ’’
INTEGER :: TEAM_NO, HANDICAP = 0
TYPE (SINGLE_SCORE), POINTER :: HISTORY => NULL ( )
TYPE (MEMBER(9)) :: ORGANIZER = MEMBER (9) ("I. Manage",1,5,NULL ( ))
TYPE (MEMBER(9)) LEAGUE (36) ! Array of partially initialized elements
ORGANIZER is explicitly initialized, overriding the default initialization for an object of type MEMBER.
Allocated objects can also be initialized partially or totally. For example:
ALLOCATE (ORGANIZER % HISTORY) ! A partially initialized object of typeNOTE 7.35! SINGLE_SCORE is created.
A pointer component of a derived type can have as its target an object of that derived type. The type
definition can specify that in objects declared to be of this type, such a pointer is default initialized to
disassociated. For example:
TYPE (NODE), POINTER :: NEXT_NODE => NULL ( )
INTEGER :: VALUE = 0
A type such as this can be used to construct linked lists of objects of type NODE. Linked lists can also be
constructed using allocatable components.
NOTE 7.36
A pointer component of a derived type can be default initialized to have an initial target.
TYPE (NODE), POINTER :: NEXT_NODE => SENTINEL
INTEGER :: VALUE = 0
TYPE(NODE), SAVE, TARGET :: SENTINEL
⃝
c ISO/IEC 2017 – All rights reserved 79
ISO/IEC DIS 1539-1:2017 (E)1 Component order is an ordering of the nonparent components of a derived type; it is used for intrinsic format-<IP_ADDRESS> Component order
ted input/output and structure constructors where component keywords are not used. Parent components are2 The component order of a nonextended type is the order of the declarations of the components in the derived-typeexcluded from the component order of an extended type (7.5.7).
definition. The component order of an extended type consists of the component order of its parent type followed1 The default accessibility for the components that are declared in a type’s component-part is private if the typeby any additional components in the order of their declarations in the extended derived-type definition.
NOTE 7.37
Given the same type definitions as in NOTE 7.23, the component order of type T1 is just A (there is only
one component), and the component order of type T2 is A then FLAG. The parent component (T1) does
not participate in the component order.
<IP_ADDRESS> Component accessibility
R745 private-components-stmt is PRIVATE
C767 (R745) A private-components-stmt is permitted only if the type definition is within the specification part
of a module.
definition contains a private-components-stmt, and public otherwise. The accessibility of a component may be2 If a component is private, that component name is accessible only within the module containing the definition,explicitly declared by an access-spec; otherwise its accessibility is the default for the type definition in which it is
declared.
and within its descendants.NOTE 7.38
Type parameters are not components. They are effectively always public.
NOTE 7.39
The accessibility of the components of a type is independent of the accessibility of the type name. It is
possible to have all four combinations: a public type name with a public component, a private type name
with a private component, a public type name with a private component, and a private type name with a
public component.
NOTE 7.40
An example of a public type with private components is:
TYPE, PUBLIC :: POINT
REAL :: X, Y
Such a type definition can be accessed by use association; however, the components X and Y are accessible
only within the module and its descendants.
| 80 | |
c ISO/IEC 2017 – All rights reservedNOTE 7.41 | |
|
The following example illustrates the use of an individual component access-spec to override the default accessibility: | |
INTEGER :: I
INTEGER, PUBLIC :: J
TYPE (MIXED) :: M
The component M%J is accessible in any scoping unit where M is accessible; M%I is accessible only within
the module containing the TYPE MIXED definition, and within its descendants.
| 7.5.5 |
Type-bound procedures
binding-name within that derived type definition.1 If => procedure-name does not appear in a type-bound-proc-decl, it is as though => procedure-name had appeared
with a procedure name the same as the binding name.2 A type-bound procedure statement declares one or more specific type-bound procedures. A specific type-bound
procedure can have a passed-object dummy argument (<IP_ADDRESS>). A type-bound procedure with the DEFERRED3 A GENERIC statement declares a generic type-bound procedure, which is a type-bound generic interface for its
specific type-bound procedures.4 A binding of a type is a type-bound procedure (specific or generic), a generic type-bound interface, or a final
subroutine. These are referred to as specific bindings, generic bindings, and final bindings respectively.5 A type-bound procedure may be identified by a binding name in the scope of the type definition. This name is the
binding-name for a specific type-bound procedure, and the generic-name for a generic binding whose generic-spec6 The interface of a specific type-bound procedure is that of the procedure specified by procedure-name or the
interface specified by interface-name.7 The same generic-spec may be used in several GENERIC statements within a single derived-type definition. Each
additional GENERIC statement with the same generic-spec extends the generic interface.8 The default accessibility for the type-bound procedures of a type is private if the type definition contains a binding-
private-stmt, and public otherwise. The accessibility of a type-bound procedure may be explicitly declared by an9 A public type-bound procedure is accessible via any accessible object of the type. A private type-bound procedure
is accessible only within the module containing the type definition, and within its descendants. | ||||||||||||||||||||||||||||
REAL :: X, Y
PROCEDURE, PASS :: LENGTH => POINT_LENGTH
...
and in the module-subprogram-part of the same module:
REAL FUNCTION POINT_LENGTH (A, B)CLASS (POINT), INTENT (IN) :: A, B
POINT_LENGTH = SQRT ( (A%X - B%X)**2 + (A%Y - B%Y)**2 )