Fortran Language Reference Manual, Volume 1


Table of Contents
Preface
Cray Fortran Compiler Messages
Accessing Cray Documentation
Conventions
BNF Conventions
Ordering Documentation
Reader Comments
1. Introduction
1.1. FORTRAN 77 Compatibility
1.2. Fortran 90 Compatibility
1.2.1. Fortran 95 Language Standard
1.2.2. Program Conformance
1.2.3. Processor Conformance
1.2.4. Portability
1.3. Fortran 2003 Compatibility
1.4. Overview of Cray Fortran Co-array
1.5. Related Cray Fortran Publications
1.6. Related Fortran Publications
1.7. Related Publications
2. Fortran Concepts and Terms
2.1. Scope and Association
2.1.1. Scoping Units
2.1.2. Association
2.2. Program Organization
2.2.1. Program Units
2.2.2. Packaging
2.3. Data Environment
2.3.1. Data Type
2.3.2. Kind
2.3.3. Dimensionality
2.3.4. Dynamic Data
2.4. Program Execution
2.4.1. Execution Sequence
2.4.2. Definition and Undefinition
2.4.3. Dynamic Behavior
2.5. Summary of Forms
2.5.1. Program Units
2.5.2. Main Program
2.5.3. External Subprogram
2.5.4. Module
2.5.5. Block Data
2.5.6. Internal Subprogram
2.5.7. Procedure Headings
2.5.8. Procedure Endings
2.5.9. Specification Constructs
2.5.10. Derived-type Definition
2.5.11. Interface Block
2.5.12. Specification Statements
2.5.13. Type Declaration Statements
2.5.14. Attribute Specifications
2.5.15. Execution Part
2.5.16. Action Statements
2.5.17. CASE Construct
2.5.18. DO Construct
2.5.19. IF Construct
2.5.20. FORALL Construct
2.5.21. WHERE Construct
2.6. Ordering Requirements
2.7. Example Fortran Program
3. Language Elements and Source Form
3.1. Cray Fortran Character Set
3.2. Lexical Tokens
3.2.1. Statement Keywords
3.2.2. Names
3.2.3. Constants
3.2.4. Operators
3.2.5. Statement Labels
3.3. Source Form
3.3.1. Free Source Form
3.3.2. Fixed Source Form
3.4. Portable Source Form
3.4.1. Sample Program, Use with Either Source Form
3.5. The INCLUDE Line
3.6. Low-level Syntax
4. Data Types
4.1. Building the Data Environment for a Problem Solution
4.1.1. Choosing the Type and Other Attributes of a Variable
4.1.2. Choosing the Kind of a Variable of Intrinsic Type
4.1.3. Choosing to Define a Type for a Variable
4.2. What Is Meant by type in Fortran
4.2.1. Data Type Names
4.2.2. Data Type Values
4.2.3. Data Type Operations
4.2.4. Forms for Constants and Constructors
4.3. Intrinsic Data Types
4.3.1. Integer Type
4.3.2. Real Type
4.3.3. Complex Type
4.3.4. Logical Type
4.3.5. Character Type
4.3.6. Boolean Type (EXTENSION)
4.3.7. Cray Pointer Type (EXTENSION)
4.3.8. Cray Character Pointer Type (EXTENSION)
4.4. Derived Types
4.4.1. Derived Type Definition
4.4.2. Derived Type Values
4.4.3. Derived Type Operations
4.4.4. Syntax for Specifying Derived-type Constant Expressions
4.5. Type Aliases
4.6. Enumeration and Enumerators
4.7. Structure Constructors
4.8. Array Constructors
5. Declarations
5.1. Type Declaration Statements
5.1.1. Integer
5.1.2. Real
5.1.3. Double Precision
5.1.4. Complex
5.1.5. Logical
5.1.6. Character
5.1.7. Derived Type
5.1.8. Cray Pointer (EXTENSION)
5.1.9. Cray Character Pointer (EXTENSION)
5.2. Implicit Typing
5.3. Array Properties
5.3.1. Array Specifications
5.3.2. DIMENSION Attribute and Statement
5.4. POINTER Properties
5.4.1. POINTER Attribute and Statement
5.4.2. TARGET Attribute and Statement
5.5. Data Initialization and the DATA Statement
5.5.1. PARAMETER Attribute and Statement
5.6. Object Accessibility and Use
5.6.1. PUBLIC and PRIVATE Attributes and Statements
5.6.2. PROTECTED Attribute and Statement
5.6.3. INTENT Attribute and Statement
5.6.4. VALUE Attribute and Statement
5.6.5. BIND Attribute and Statement
5.6.6. OPTIONAL Attribute and Statement
5.7. Procedure Properties
5.7.1. EXTERNAL Attribute and Statement
5.7.2. INTRINSIC Attribute and Statement
5.8. Automatic Data Objects
5.9. AUTOMATIC Attribute and Statement (EXTENSION)
5.10. ALLOCATABLE Attribute and Statement
5.11. SAVE and STATIC Attributes and Statements
5.12. VOLATILE Attribute and Statement
5.13. NAMELIST Statement
5.14. Storage Association
5.14.1. Storage Units
5.14.2. Storage Sequence
5.14.3. EQUIVALENCE Statement
5.14.4. COMMON Statement
5.14.5. Restrictions on Common and Equivalence
6. Using Data
6.1. Constants and Variables
6.2. Substrings
6.3. Structure Components
6.4. Arrays
6.4.1. Array Terminology
6.4.2. Whole Arrays
6.4.3. Array Elements
6.4.4. Array Sections
6.4.5. Format of Array Elements and Array Sections
6.4.6. Using Array Elements and Array Sections
6.4.7. Array Element Order
6.5. Pointers and Allocatable Objects
6.5.1. ALLOCATE Statement
6.5.2. NULLIFY Statement
6.5.3. DEALLOCATE Statement
7. Expressions and Assignments
7.1. Introduction to Expressions
7.1.1. Assignment
7.1.2. Expressions
7.2. Formation of Expressions
7.2.1. Operands
7.2.2. Binary and Unary Operations
7.2.3. Intrinsic and Defined Operations
7.2.4. Rules for Forming Expressions
7.2.5. Precedence of Operators
7.2.6. Intrinsic Operations
7.2.7. Defined Operations
7.2.8. Data Type, Type Parameters, and Shape of an Expression
7.2.9. Special Expressions
7.3. Interpretation of Expressions
7.3.1. Interpretation of the Intrinsic Operations
7.3.2. Interpretation of Defined Operations
7.4. Evaluation of Expressions
7.4.1. Possible Alternative Evaluations
7.4.2. Partial Evaluations
7.5. Assignment
7.5.1. Intrinsic Assignment
7.5.2. Defined Assignment
7.5.3. Pointer Assignment
7.5.4. Masked Array Assignment
7.5.5. FORALL Statement and Construct
8. Controlling Execution
8.1. The Execution Sequence
8.2. Blocks and Executable Constructs
8.3. IF Construct and IF Statement
8.3.1. The IF Construct
8.3.2. IF Statement
8.4. CASE Construct
8.4.1. Form of the CASE Construct
8.4.2. Execution of the CASE Construct
8.5. ASSOCIATE Construct
8.6. DO Construct
8.6.1. Form of the Block DO Construct
8.6.2. Form of the Nonblock DO Construct
8.6.3. Range of a DO Construct
8.6.4. Active and Inactive DO Constructs
8.6.5. Execution of DO Constructs
8.6.6. Altering the Execution Sequence Within the Range of a DO Construct
8.7. Branching
8.7.1. Use of Labels in Branching
8.7.2. GO TO Statement
8.7.3. Computed GO TO Statement
8.7.4. CONTINUE Statement
8.7.5. STOP Statement
8.8. Arithmetic IF Statement (Obsolescent)
Glossary
Index
List of Tables
4-1. Integer Kind Values
4-2. Exponent Equivalents
4-9. Real and Complex Kind Values
4-10. Exponent Equivalents
4-12. Complex Kind Values
5-27. Types, Attributes, and Storage
6-8. Message number identifiers
6-11. Message number identifiers
7-1. Intrinsic Operators and the Allowed Types of their Operands
7-2. The Hierarchy of Expressions Through Forms
7-16. Categories of Operations and Relative Precedences
7-17. Operand Types and Results for Intrinsic Operations
7-18. Type and Type Parameters of Some Simple Expressions
7-19. Differences and Similarities Between Initialization and Specification Expressions
7-20. Kinds of Expressions and Their Uses
7-21. Interpretation of the Intrinsic Operations
7-22. The Values of Operations Involving Logical Operators
7-23. Equivalent Evaluations for Numeric Intrinsic Operations
7-24. Nonequivalent Evaluations of Numeric Expressions
7-25. Equivalent Evaluations Of Other Expressions
7-27. Types Of The Variable And Expression In An Intrinsic Assignment
7-28. Conversion Performed On An Expression Before Assignment
List of Figures
2-1. Program Packaging Example
2-2. Requirements on Statement Ordering
2-3. Restrictions on the Appearance of Statements
4-1. Fortran Data Types
4-2. Forms of Constants and Constructors
5-1. Default Implicit Mapping for a Program Unit
5-2. Character Alignment Example
5-3. Numeric Array Alignment Example
5-4. Storage of REUSE in FIRST and SECOND
5-5. Alignment Resulting from Correct Code
5-6. Alignment Resulting from Incorrect Code
6-1. Computation of Subscript Order Value
6-2. States in the Lifetime of a Pointer
7-1. The Hierarchy of Expressions by Examples
7-2. Example Ordering of Numeric Types
7-3. Relationships Between the Kinds of Expressions
8-1. Execution Flow for an IF Construct
8-2. Execution flow for a CASE Construct
8-3. Execution flow for a DO Construct