Already a subscriber?
MADCAD.com Free Trial
Sign up for a 3 day free trial to explore the MADCAD.com interface, PLUS access the
2009 International Building Code to see how it all works.
If you like to setup a quick demo, let us know at support@madcad.com
or +1 800.798.9296 and we will be happy to schedule a webinar for you.
Security check
Please login to your personal account to use this feature.
Please login to your authorized staff account to use this feature.
Are you sure you want to empty the cart?
BS ISO/IEC 1539-1:2023 Programming languages. Fortran - Base language, 2024
- undefined
- Contents
- Foreword
- Introduction
- 1 Scope
- 2 Normative references
- 3 Terms and definitions
- 4 Notation, conformance, and compatibility [Go to Page]
- 4.1 Notation, symbols and abbreviated terms [Go to Page]
- 4.1.1 Syntax rules
- 4.1.2 Constraints
- 4.1.3 Assumed syntax rules
- 4.1.4 Syntax conventions and characteristics
- 4.1.5 Text conventions
- 4.2 Conformance
- 4.3 Compatibility [Go to Page]
- 4.3.1 Previous Fortran standards
- 4.3.2 New intrinsic procedures
- 4.3.3 Fortran 2018 compatibility
- 4.3.4 Fortran 2008 compatibility
- 4.3.5 Fortran 2003 compatibility
- 4.3.6 Fortran 95 compatibility
- 4.3.7 Fortran 90 compatibility
- 4.3.8 FORTRAN 77 compatibility
- 4.4 Deleted and obsolescent features [Go to Page]
- 4.4.1 General
- 4.4.2 Nature of deleted features
- 4.4.3 Nature of obsolescent features
- 5 Fortran concepts [Go to Page]
- 5.1 High level syntax
- 5.2 Program unit concepts [Go to Page]
- 5.2.1 Program units and scoping units
- 5.2.2 Program
- 5.2.3 Procedure
- 5.2.4 Module
- 5.2.5 Submodule
- 5.3 Execution concepts [Go to Page]
- 5.3.1 Statement classification
- 5.3.2 Statement order
- 5.3.3 The END statement
- 5.3.4 Program execution
- 5.3.5 Execution sequence
- 5.3.6 Image execution states
- 5.3.7 Termination of execution
- 5.4 Data concepts [Go to Page]
- 5.4.1 Type
- 5.4.2 Data value
- 5.4.3 Data entity
- 5.4.4 Definition of objects and pointers
- 5.4.5 Reference
- 5.4.6 Array
- 5.4.7 Coarray
- 5.4.8 Established coarrays
- 5.4.9 Pointer
- 5.4.10 Allocatable variables
- 5.4.11 Storage
- 5.5 Fundamental concepts [Go to Page]
- 5.5.1 Names and designators
- 5.5.2 Statement keyword
- 5.5.3 Other keywords
- 5.5.4 Association
- 5.5.5 Intrinsic
- 5.5.6 Operator
- 5.5.7 Companion processors
- 6 Lexical tokens and source form [Go to Page]
- 6.1 Processor character set [Go to Page]
- 6.1.1 Characters
- 6.1.2 Letters
- 6.1.3 Digits
- 6.1.4 Underscore
- 6.1.5 Special characters
- 6.1.6 Other characters
- 6.2 Low-level syntax [Go to Page]
- 6.2.1 Tokens
- 6.2.2 Names
- 6.2.3 Constants
- 6.2.4 Operators
- 6.2.5 Statement labels
- 6.2.6 Delimiters
- 6.3 Source form [Go to Page]
- 6.3.1 Program units, statements, and lines
- 6.3.2 Free source form
- 6.3.3 Fixed source form
- 6.4 Including source text
- 7 Types [Go to Page]
- 7.1 Characteristics of types [Go to Page]
- 7.1.1 The concept of type
- 7.1.2 Type classification
- 7.1.3 Set of values
- 7.1.4 Constants
- 7.1.5 Operations
- 7.2 Type parameters
- 7.3 Types, type specifiers, and values [Go to Page]
- 7.3.1 Relationship of types and values to objects
- 7.3.2 Type specifiers
- 7.3.3 Type compatibility
- 7.4 Intrinsic types [Go to Page]
- 7.4.1 Classification and specification
- 7.4.2 Intrinsic operations on intrinsic types
- 7.4.3 Numeric intrinsic types
- 7.4.4 Character type
- 7.4.5 Logical type
- 7.5 Derived types [Go to Page]
- 7.5.1 Derived type concepts
- 7.5.2 Derived-type definition
- 7.5.3 Derived-type parameters
- 7.5.4 Components
- 7.5.5 Type-bound procedures
- 7.5.6 Final subroutines
- 7.5.7 Type extension
- 7.5.8 Derived-type values
- 7.5.9 Derived-type specifier
- 7.5.10 Construction of derived-type values
- 7.5.11 Derived-type operations and assignment
- 7.6 Other nonintrinsic types [Go to Page]
- 7.6.1 Interoperable enumerations and enum types
- 7.6.2 Enumeration types
- 7.7 Binary, octal, and hexadecimal literal constants
- 7.8 Construction of array values
- 8 Attribute declarations and specifications [Go to Page]
- 8.1 Attributes of procedures and data objects
- 8.2 Type declaration statement
- 8.3 Automatic data objects
- 8.4 Initialization
- 8.5 Attributes [Go to Page]
- 8.5.1 Attribute specification
- 8.5.2 Accessibility attribute
- 8.5.3 ALLOCATABLE attribute
- 8.5.4 ASYNCHRONOUS attribute
- 8.5.5 BIND attribute for data entities
- 8.5.6 CODIMENSION attribute
- 8.5.7 CONTIGUOUS attribute
- 8.5.8 DIMENSION attribute
- 8.5.9 EXTERNAL attribute
- 8.5.10 INTENT attribute
- 8.5.11 INTRINSIC attribute
- 8.5.12 OPTIONAL attribute
- 8.5.13 PARAMETER attribute
- 8.5.14 POINTER attribute
- 8.5.15 PROTECTED attribute
- 8.5.16 SAVE attribute
- 8.5.17 RANK clause
- 8.5.18 TARGET attribute
- 8.5.19 VALUE attribute
- 8.5.20 VOLATILE attribute
- 8.6 Attribute specification statements [Go to Page]
- 8.6.1 Accessibility statement
- 8.6.2 ALLOCATABLE statement
- 8.6.3 ASYNCHRONOUS statement
- 8.6.4 BIND statement
- 8.6.5 CODIMENSION statement
- 8.6.6 CONTIGUOUS statement
- 8.6.7 DATA statement
- 8.6.8 DIMENSION statement
- 8.6.9 INTENT statement
- 8.6.10 OPTIONAL statement
- 8.6.11 PARAMETER statement
- 8.6.12 POINTER statement
- 8.6.13 PROTECTED statement
- 8.6.14 SAVE statement
- 8.6.15 TARGET statement
- 8.6.16 VALUE statement
- 8.6.17 VOLATILE statement
- 8.7 IMPLICIT statement
- 8.8 IMPORT statement
- 8.9 NAMELIST statement
- 8.10 Storage association of data objects [Go to Page]
- 8.10.1 EQUIVALENCE statement
- 8.10.2 COMMON statement
- 8.10.3 Restrictions on common and equivalence
- 9 Use of data objects [Go to Page]
- 9.1 Designator
- 9.2 Variable
- 9.3 Constants
- 9.4 Scalars [Go to Page]
- 9.4.1 Substrings
- 9.4.2 Structure components
- 9.4.3 Coindexed named objects
- 9.4.4 Complex parts
- 9.4.5 Type parameter inquiry
- 9.5 Arrays [Go to Page]
- 9.5.1 Order of reference
- 9.5.2 Whole arrays
- 9.5.3 Array elements and array sections
- 9.5.4 Simply contiguous array designators
- 9.6 Image selectors
- 9.7 Dynamic association [Go to Page]
- 9.7.1 ALLOCATE statement
- 9.7.2 NULLIFY statement
- 9.7.3 DEALLOCATE statement
- 9.7.4 STAT= specifier
- 9.7.5 ERRMSG= specifier
- 10 Expressions and assignment [Go to Page]
- 10.1 Expressions [Go to Page]
- 10.1.1 Expression semantics
- 10.1.2 Form of an expression
- 10.1.3 Precedence of operators
- 10.1.4 Evaluation of operations
- 10.1.5 Intrinsic operations
- 10.1.6 Defined operations
- 10.1.7 Evaluation of operands
- 10.1.8 Integrity of parentheses
- 10.1.9 Type, type parameters, and shape of an expression
- 10.1.10 Conformability rules for elemental operations
- 10.1.11 Specification expression
- 10.1.12 Constant expression
- 10.2 Assignment [Go to Page]
- 10.2.1 Assignment statement
- 10.2.2 Pointer assignment
- 10.2.3 Masked array assignment – WHERE
- 10.2.4 FORALL
- 11 Execution control [Go to Page]
- 11.1 Executable constructs containing blocks [Go to Page]
- 11.1.1 Blocks
- 11.1.2 Rules governing blocks
- 11.1.3 ASSOCIATE construct
- 11.1.4 BLOCK construct
- 11.1.5 CHANGE TEAM construct
- 11.1.6 CRITICAL construct
- 11.1.7 DO construct
- 11.1.8 IF construct and statement
- 11.1.9 SELECT CASE construct
- 11.1.10 SELECT RANK construct
- 11.1.11 SELECT TYPE construct
- 11.1.12 EXIT statement
- 11.2 Branching [Go to Page]
- 11.2.1 Branch concepts
- 11.2.2 GO TO statement
- 11.2.3 Computed GO TO statement
- 11.3 CONTINUE statement
- 11.4 STOP and ERROR STOP statements
- 11.5 FAIL IMAGE statement
- 11.6 NOTIFY WAIT statement
- 11.7 Image execution control [Go to Page]
- 11.7.1 Image control statements
- 11.7.2 Segments
- 11.7.3 SYNC ALL statement
- 11.7.4 SYNC IMAGES statement
- 11.7.5 SYNC MEMORY statement
- 11.7.6 SYNC TEAM statement
- 11.7.7 EVENT POST statement
- 11.7.8 EVENT WAIT statement
- 11.7.9 FORM TEAM statement
- 11.7.10 LOCK and UNLOCK statements
- 11.7.11 STAT= and ERRMSG= specifiers in image control statements
- 12 Input/output statements [Go to Page]
- 12.1 Input/output concepts
- 12.2 Records [Go to Page]
- 12.2.1 Definition of a record
- 12.2.2 Formatted record
- 12.2.3 Unformatted record
- 12.2.4 Endfile record
- 12.3 External files [Go to Page]
- 12.3.1 External file concepts
- 12.3.2 File existence
- 12.3.3 File access
- 12.3.4 File position
- 12.3.5 File storage units
- 12.4 Internal files
- 12.5 File connection [Go to Page]
- 12.5.1 Referring to a file
- 12.5.2 Connection modes
- 12.5.3 Unit existence
- 12.5.4 Connection of a file to a unit
- 12.5.5 Preconnection
- 12.5.6 OPEN statement
- 12.5.7 CLOSE statement
- 12.6 Data transfer statements [Go to Page]
- 12.6.1 Form of input and output statements
- 12.6.2 Control information list
- 12.6.3 Data transfer input/output list
- 12.6.4 Execution of a data transfer input/output statement
- 12.6.5 Termination of data transfer statements
- 12.7 Waiting on pending data transfer [Go to Page]
- 12.7.1 Wait operation
- 12.7.2 WAIT statement
- 12.8 File positioning statements [Go to Page]
- 12.8.1 Syntax
- 12.8.2 BACKSPACE statement
- 12.8.3 ENDFILE statement
- 12.8.4 REWIND statement
- 12.9 FLUSH statement
- 12.10 File inquiry statement [Go to Page]
- 12.10.1 Forms of the INQUIRE statement
- 12.10.2 Inquiry specifiers
- 12.10.3 Inquire by output list
- 12.11 Error, end-of-record, and end-of-file conditions [Go to Page]
- 12.11.1 Occurrence of input/output conditions
- 12.11.2 Error conditions and the ERR= specifier
- 12.11.3 End-of-file condition and the END= specifier
- 12.11.4 End-of-record condition and the EOR= specifier
- 12.11.5 IOSTAT= specifier
- 12.11.6 IOMSG= specifier
- 12.12 Restrictions on input/output statements
- 13 Input/output editing [Go to Page]
- 13.1 Format specifications
- 13.2 Explicit format specification methods [Go to Page]
- 13.2.1 FORMAT statement
- 13.2.2 Character format specification
- 13.3 Form of a format item list [Go to Page]
- 13.3.1 Syntax
- 13.3.2 Edit descriptors
- 13.3.3 Fields
- 13.4 Interaction between input/output list and format
- 13.5 Positioning by format control
- 13.6 Decimal symbol
- 13.7 Data edit descriptors [Go to Page]
- 13.7.1 Purpose of data edit descriptors
- 13.7.2 Numeric editing
- 13.7.3 Logical editing
- 13.7.4 Character editing
- 13.7.5 Generalized editing
- 13.7.6 User-defined derived-type editing
- 13.8 Control edit descriptors [Go to Page]
- 13.8.1 Position edit descriptors
- 13.8.2 Slash editing
- 13.8.3 Colon editing
- 13.8.4 SS, SP, and S editing
- 13.8.5 LZS, LZP and LZ editing
- 13.8.6 P editing
- 13.8.7 BN and BZ editing
- 13.8.8 RU, RD, RZ, RN, RC, and RP editing
- 13.8.9 DC and DP editing
- 13.9 Character string edit descriptors
- 13.10 List-directed formatting [Go to Page]
- 13.10.1 Purpose of list-directed formatting
- 13.10.2 Values and value separators
- 13.10.3 List-directed input
- 13.10.4 List-directed output
- 13.11 Namelist formatting [Go to Page]
- 13.11.1 Purpose of namelist formatting
- 13.11.2 Name-value subsequences
- 13.11.3 Namelist input
- 13.11.4 Namelist output
- 14 Program units [Go to Page]
- 14.1 Main program
- 14.2 Modules [Go to Page]
- 14.2.1 Module syntax and semantics
- 14.2.2 The USE statement and use association
- 14.2.3 Submodules
- 14.3 Block data program units
- 15 Procedures [Go to Page]
- 15.1 Concepts
- 15.2 Procedure classifications [Go to Page]
- 15.2.1 Procedure classification by reference
- 15.2.2 Procedure classification by means of definition
- 15.3 Characteristics [Go to Page]
- 15.3.1 Characteristics of procedures
- 15.3.2 Characteristics of dummy arguments
- 15.3.3 Characteristics of function results
- 15.4 Procedure interface [Go to Page]
- 15.4.1 Interface and abstract interface
- 15.4.2 Implicit and explicit interfaces
- 15.4.3 Specification of the procedure interface
- 15.5 Procedure reference [Go to Page]
- 15.5.1 Syntax of a procedure reference
- 15.5.2 Actual arguments, dummy arguments, and argument association
- 15.5.3 Function reference
- 15.5.4 Subroutine reference
- 15.5.5 Resolving named procedure references
- 15.5.6 Resolving type-bound procedure references
- 15.6 Procedure definition [Go to Page]
- 15.6.1 Intrinsic procedure definition
- 15.6.2 Procedures defined by subprograms
- 15.6.3 Definition and invocation of procedures by means other than Fortran
- 15.6.4 Statement function
- 15.7 Pure procedures
- 15.8 Simple procedures
- 15.9 Elemental procedures [Go to Page]
- 15.9.1 Elemental procedure declaration and interface
- 15.9.2 Elemental function actual arguments and results
- 15.9.3 Elemental subroutine actual arguments
- 16 Intrinsic procedures and modules [Go to Page]
- 16.1 Classes of intrinsic procedures
- 16.2 Arguments to intrinsic procedures [Go to Page]
- 16.2.1 General rules
- 16.2.2 The shape of array arguments
- 16.2.3 Mask arguments
- 16.2.4 DIM arguments and reduction functions
- 16.3 Bit model [Go to Page]
- 16.3.1 General
- 16.3.2 Bit sequence comparisons
- 16.3.3 Bit sequences as arguments to INT and REAL
- 16.4 Numeric models
- 16.5 Atomic subroutines
- 16.6 Collective subroutines
- 16.7 Standard generic intrinsic procedures
- 16.8 Specific names for standard intrinsic functions
- 16.9 Specifications of the standard intrinsic procedures [Go to Page]
- 16.9.1 General
- 16.10 Standard intrinsic modules [Go to Page]
- 16.10.1 General
- 16.10.2 The ISO_FORTRAN_ENV intrinsic module
- 17 Exceptions and IEEE arithmetic [Go to Page]
- 17.1 Overview of IEEE arithmetic support
- 17.2 Derived types, constants, and operators defined in the modules
- 17.3 The exceptions
- 17.4 The rounding modes
- 17.5 Underflow mode
- 17.6 Halting
- 17.7 The floating-point modes and status
- 17.8 Exceptional values
- 17.9 IEEE arithmetic
- 17.10 Summary of the procedures
- 17.11 Specifications of the procedures [Go to Page]
- 17.11.1 General
- 17.12 Examples
- 18 Interoperability with C [Go to Page]
- 18.1 General
- 18.2 The ISO_C_BINDING intrinsic module [Go to Page]
- 18.2.1 Summary of contents
- 18.2.2 Named constants and derived types in the module
- 18.2.3 Procedures in the module
- 18.3 Interoperability between Fortran and C entities [Go to Page]
- 18.3.1 Interoperability of intrinsic types
- 18.3.2 Interoperability with C pointer types
- 18.3.3 Interoperability of enum types
- 18.3.4 Interoperability of derived types and C structure types
- 18.3.5 Interoperability of scalar variables
- 18.3.6 Interoperability of array variables
- 18.3.7 Interoperability of procedures and procedure interfaces
- 18.4 C descriptors
- 18.5 The source file ISO_Fortran_binding.h [Go to Page]
- 18.5.1 Summary of contents
- 18.5.2 The CFI_dim_t structure type
- 18.5.3 The CFI_cdesc_t structure type
- 18.5.4 Macros and typedefs in ISO_Fortran_binding.h
- 18.5.5 Functions declared in ISO_Fortran_binding.h
- 18.6 Restrictions on C descriptors
- 18.7 Restrictions on formal parameters
- 18.8 Restrictions on lifetimes
- 18.9 Interoperation with C global variables [Go to Page]
- 18.9.1 General
- 18.9.2 Binding labels for common blocks and variables
- 18.10 Interoperation with C functions [Go to Page]
- 18.10.1 Definition and reference of interoperable procedures
- 18.10.2 Binding labels for procedures
- 18.10.3 Exceptions and IEEE arithmetic procedures
- 18.10.4 Asynchronous communication
- 19 Scope, association, and definition [Go to Page]
- 19.1 Scopes, identifiers, and entities
- 19.2 Global identifiers
- 19.3 Local identifiers [Go to Page]
- 19.3.1 Classes of local identifiers
- 19.3.2 Local identifiers that are the same as common block names
- 19.3.3 Function results
- 19.3.4 Components, type parameters, and bindings
- 19.3.5 Argument keywords
- 19.4 Statement and construct entities
- 19.5 Association [Go to Page]
- 19.5.1 Name association
- 19.5.2 Pointer association
- 19.5.3 Storage association
- 19.5.4 Inheritance association
- 19.5.5 Establishing associations
- 19.6 Definition and undefinition of variables [Go to Page]
- 19.6.1 Definition of objects and subobjects
- 19.6.2 Variables that are always defined
- 19.6.3 Variables that are initially defined
- 19.6.4 Variables that are initially undefined
- 19.6.5 Events that cause variables to become defined
- 19.6.6 Events that cause variables to become undefined
- 19.6.7 Variable definition context
- 19.6.8 Pointer association context
- Annex A (informative) Processor dependencies [Go to Page]
- A.1 Unspecified items
- A.2 Processor dependencies
- Annex B (informative) Deleted and obsolescent features [Go to Page]
- B.1 Deleted features from Fortran 90
- B.2 Deleted features from Fortran 2008
- B.3 Obsolescent features [Go to Page]
- B.3.1 General
- B.3.2 Alternate return
- B.3.3 Computed GO TO statement
- B.3.4 Statement functions
- B.3.5 DATA statements among executables
- B.3.6 Assumed character length functions
- B.3.7 Fixed form source
- B.3.8 CHARACTER* form of CHARACTER declaration
- B.3.9 ENTRY statements
- B.3.10 Label DO statement
- B.3.11 COMMON and EQUIVALENCE statements and the block data program unit
- B.3.12 Specific names for intrinsic functions
- B.3.13 FORALL construct and statement
- Annex C (informative) Extended notes [Go to Page]
- C.1 Features that were new in Fortran 2018
- C.2 Fortran 2008 features not mentioned in its Introduction
- C.3 Clause 7 notes [Go to Page]
- C.3.1 Selection of the approximation methods (7.4.3.2)
- C.3.2 Type extension and component accessibility (7.5.2.2, 7.5.4)
- C.3.3 Generic type-bound procedures (7.5.5)
- C.3.4 Abstract types (7.5.7.1)
- C.3.5 Structure constructors and generic names (7.5.10)
- C.3.6 Final subroutines (7.5.6, 7.5.6.2, 7.5.6.3, 7.5.6.4)
- C.4 Clause 8 notes: The VOLATILE attribute (8.5.20)
- C.5 Clause 9 notes [Go to Page]
- C.5.1 Structure components (9.4.2)
- C.5.2 Allocation with dynamic type (9.7.1)
- C.6 Clause 10 notes [Go to Page]
- C.6.1 Evaluation of function references (10.1.7)
- C.6.2 Pointers in expressions (10.1.9.2)
- C.6.3 Pointers in variable definition contexts (10.2.1.3, 19.6.7)
- C.7 Clause 11 notes [Go to Page]
- C.7.1 The SELECT CASE construct (11.1.9)
- C.7.2 Loop control (11.1.7)
- C.7.3 Examples of DO constructs (11.1.7)
- C.7.4 Examples of invalid DO constructs (11.1.7)
- C.7.5 Simple example using events
- C.7.6 Example using three teams
- C.7.7 Accessing coarrays in sibling teams
- C.7.8 Example involving failed images
- C.7.9 EVENT_QUERY example that tolerates image failure
- C.8 Clause 12 notes [Go to Page]
- C.8.1 External files (12.3)
- C.8.2 Nonadvancing input/output (12.3.4.2)
- C.8.3 OPEN statement (12.5.6)
- C.8.4 Connection properties (12.5.4)
- C.8.5 Asynchronous input/output (12.6.2.5)
- C.9 Clause 13 notes [Go to Page]
- C.9.1 Number of records (13.4, 13.5, 13.8.2)
- C.9.2 List-directed input (13.10.3)
- C.10 Clause 14 notes [Go to Page]
- C.10.1 Main program and block data program unit (14.1, 14.3)
- C.10.2 Dependent compilation (14.2)
- C.10.3 Examples of the use of modules (14.2.1)
- C.10.4 Modules with submodules (14.2.3)
- C.11 Clause 15 notes [Go to Page]
- C.11.1 Portability problems with external procedures (15.4.3.5)
- C.11.2 Procedures defined by means other than Fortran (15.6.3)
- C.11.3 Abstract interfaces and procedure pointer components (15.4, 7.5)
- C.11.4 Pointers and targets as arguments (15.5.2.5, 15.5.2.7, 15.5.2.8)
- C.11.5 Polymorphic Argument Association (15.5.2.10)
- C.11.6 Rules ensuring unambiguous generics (15.4.3.4.5)
- C.12 Clause 16 notes [Go to Page]
- C.12.1 Atomic memory consistency
- C.12.2 EVENT_QUERY example
- C.12.3 Collective subroutine examples
- C.13 Clause 18 notes [Go to Page]
- C.13.1 Runtime environments (18.1)
- C.13.2 Example of Fortran calling C (18.3)
- C.13.3 Example of C calling Fortran (18.3)
- C.13.4 Example of calling C functions with noninteroperable data (18.10)
- C.13.5 Example of opaque communication between C and Fortran (18.3)
- C.13.6 Using assumed type to interoperate with C
- C.13.7 Using assumed-type variables in Fortran
- C.13.8 Simplifying interfaces for arbitrary rank procedures
- C.13.9 Processing assumed-rank in C
- C.13.10 Creating a contiguous copy of an array
- C.13.11 Changing the attributes of an array
- C.13.12 Creating an array section in C using CFI_section
- C.13.13 Use of CFI_setpointer
- C.13.14 Mapping of MPI interfaces to Fortran
- C.14 Clause 19 notes [Go to Page]
- C.14.1 Examples of global identifiers and binding labels (19.2)
- C.14.2 Examples of host association (19.5.1.4)
- Index [Go to Page]