Fortran Reference Guide
Total Page:16
File Type:pdf, Size:1020Kb
FORTRAN REFERENCE GUIDE Version 2017 TABLE OF CONTENTS Preface............................................................................................................xiv Audience Description.........................................................................................xiv Compatibility and Conformance to Standards........................................................... xiv Organization.................................................................................................... xv Hardware and Software Constraints.......................................................................xvi Conventions.................................................................................................... xvi Related Publications.........................................................................................xvii Chapter 1. Language Overview............................................................................... 1 1.1. Elements of a Fortran Program Unit.................................................................. 1 1.1.1. Fortran Statements................................................................................. 1 1.1.2. Free and Fixed Source............................................................................. 2 1.1.3. Statement Ordering................................................................................. 2 1.2. The Fortran Character Set.............................................................................. 3 1.3. Free Form Formatting................................................................................... 4 1.4. Fixed Formatting..........................................................................................5 1.4.1. Column Formatting..................................................................................5 1.4.2. Fixed Format Label Field.......................................................................... 5 1.4.3. Fixed Format Continuation Field................................................................. 5 1.4.4. Fixed Format Statement Field.................................................................... 6 1.4.5. Fixed Format Debug Statements..................................................................6 1.4.6. Tab Formatting.......................................................................................6 1.4.7. Fixed Input File Format Summary................................................................ 6 1.5. Include Fortran Source Files............................................................................ 7 1.6. Components of Fortran Statements................................................................... 7 1.6.1. Symbolic Names..................................................................................... 8 1.7. Expressions.................................................................................................8 1.7.1. Forming Expressions.................................................................................8 1.7.2. Expression Precedence Rules...................................................................... 9 1.7.3. Arithmetic Expressions............................................................................. 9 1.7.4. Relational Expressions.............................................................................11 1.7.5. Logical Expressions................................................................................ 12 1.7.6. Character Expressions............................................................................. 12 1.7.7. Character Concatenation......................................................................... 12 1.8. Symbolic Name Scope.................................................................................. 13 1.9. Assignment Statements.................................................................................13 1.9.1. Arithmetic Assignment............................................................................ 13 1.9.2. Logical Assignment.................................................................................14 1.9.3. Character Assignment............................................................................. 14 1.10. Listing Controls.........................................................................................15 1.11. OpenMP Directives..................................................................................... 15 Fortran Reference Guide Version 2017 | ii Chapter 2. Fortran Data Types.............................................................................. 16 2.1. Intrinsic Data Types..................................................................................... 16 2.1.1. Kind Parameter..................................................................................... 16 2.1.2. Number of Bytes Specification.................................................................. 17 2.2. Constants................................................................................................. 19 2.2.1. Integer Constants.................................................................................. 19 2.2.2. Binary, Octal and Hexadecimal Constants..................................................... 20 2.2.3. Real Constants......................................................................................20 2.2.4. Double Precision Constants.......................................................................21 2.2.5. Complex Constants................................................................................ 21 2.2.6. Double Complex Constants....................................................................... 21 2.2.7. Logical Constants.................................................................................. 21 2.2.8. Character Constants............................................................................... 22 2.2.9. Parameter Constants.............................................................................. 22 2.3. Structure Constructors................................................................................. 23 2.4. Derived Types............................................................................................ 24 2.5. Deferred Type Parameters............................................................................. 25 2.5.1. Typed Allocation................................................................................... 25 2.6. Arrays......................................................................................................26 2.6.1. Array Declaration Element....................................................................... 26 2.6.2. Deferred Shape Arrays............................................................................ 27 2.6.3. Subscripts............................................................................................27 2.6.4. Character Substring................................................................................27 2.6.5. Array Constructor Syntax......................................................................... 28 2.7. Fortran Pointers and Targets.......................................................................... 28 2.8. Fortran Binary, Octal and Hexadecimal Constants.................................................28 2.8.1. Octal and Hexadecimal Constants - Alternate Forms........................................ 29 2.9. Hollerith Constants......................................................................................30 2.10. Structures............................................................................................... 31 2.10.1. Records............................................................................................. 32 2.10.2. UNION and MAP Declarations................................................................... 33 2.10.3. Data Initialization................................................................................ 35 2.11. Pointer Variables....................................................................................... 35 2.11.1. Restrictions........................................................................................ 36 2.11.2. Pointer Assignment............................................................................... 37 Chapter 3. Fortran Statements.............................................................................. 38 3.1. Statement Format Overview.......................................................................... 38 3.1.1. Definition of Statement-related Terms.........................................................38 3.1.2. Origin of Statement............................................................................... 39 3.1.3. List-related Notation.............................................................................. 39 3.2. Fortran Statement Summary Table................................................................... 39 3.3. ACCEPT.................................................................................................... 44 3.4. ARRAY......................................................................................................45 Fortran Reference Guide Version 2017 | iii 3.5. BYTE....................................................................................................... 46 3.6. DECODE....................................................................................................47 3.7. DOUBLE COMPLEX....................................................................................... 48 3.8. DOUBLE