Intel Fortran Programmer s Fortran Programmer’s Reference

Download Intel  Fortran Programmer s   Fortran Programmer’s Reference

Post on 19-Mar-2018

229 views

Category:

Documents

8 download

Embed Size (px)

TRANSCRIPT

<ul><li><p>Intel Fortran ProgrammersReference</p><p>Copyright 1996-2003 Intel CorporationAll Rights ReservedIssued in U.S.A.Version Number: FWL-710-02</p><p>World Wide Web: http://developer.intel.com</p><p>http://developer.intel.com</p></li><li><p>Information in this document is provided in connection with Intel products. No license, express or implied, by estoppelor otherwise, to any intellectual property rights is granted by this document. EXCEPT AS PROVIDED IN INTELSTERMS AND CONDITIONS OF SALE FOR SUCH PRODUCTS, INTEL ASSUMES NO LIABILITY WHATSO-EVER, AND INTEL DISCLAIMS ANY EXPRESS OR IMPLIED WARRANTY, RELATING TO SALE AND/ORUSE OF INTEL PRODUCTS INCLUDING LIABILITY OR WARRANTIES RELATING TO FITNESS FOR A PAR-TICULAR PURPOSE, MERCHANTABILITY, OR INFRINGEMENT OF ANY PATENT, COPYRIGHT OR OTHERINTELLECTUAL PROPERTY RIGHT. Intel products are not intended for use in medical, life saving, or life sustainingapplications.</p><p>This Intel Fortran Programmers Reference as well as the software described in it is furnished under license and mayonly be used or copied in accordance with the terms of the license. The information in this manual is furnished for infor-mational use only, is subject to change without notice, and should not be construed as a commitment by Intel Corpora-tion. Intel Corporation assumes no responsibility or liability for any errors or inaccuracies that may appear in thisdocument or any software that may be provided in association with this document.</p><p>Designers must not rely on the absence or characteristics of any features or instructions marked "reserved" or "unde-fined." Intel reserves these for future definition and shall have no responsibility whatsoever for conflicts or incompatibil-ities arising from future changes to them.</p><p>Intel SpeedStep, Intel Thread Checker, Celeron, Dialogic, i386, i486, iCOMP, Intel, Intel logo, Intel386, Intel486,Intel740, IntelDX2, IntelDX4, IntelSX2, Intel Inside, Intel Inside logo, Intel NetBurst, Intel NetStructure, Intel Xeon,Intel Centrino, Intel XScale, Itanium, MMX, MMX logo, Pentium, Pentium II Xeon, Pentium III Xeon, Intel Pentium M,and VTune are trademarks or registered trademarks of Intel Corporation or its subsidiaries in the United States and othercountries.</p><p>* Other names and brands may be claimed as the property of others.</p><p>Copyright Intel Corporation 1996 - 2003.</p></li><li><p>v</p><p>ContentsAbout This Manual</p><p>Related Publications............................................................. xxivNotational Conventions.......................................................... xxv</p><p>Chapter 1 Introduction to Intel Fortran CompilerNew Features in Fortran 95 .................................................. 1-2</p><p>Source Format .................................................................. 1-2Data Types........................................................................ 1-2Operators .......................................................................... 1-3Control Constructs ............................................................ 1-3Arrays................................................................................ 1-3Procedures........................................................................ 1-4Pointers............................................................................. 1-5Modules ............................................................................ 1-5Non-advancing I/O ............................................................ 1-5Namelist I/O ...................................................................... 1-6</p><p>Chapter 2 Language ElementsCharacter Set ........................................................................ 2-1Lexical Tokens ....................................................................... 2-2Names ................................................................................... 2-2Program Structure ................................................................. 2-3Statement Labels ................................................................... 2-3</p></li><li><p>vi</p><p>Intel Fortran Programmers Reference</p><p>Construct Names ................................................................... 2-4Statements............................................................................. 2-4</p><p>Statement Order................................................................ 2-6Source Program Forms ......................................................... 2-8</p><p>Fixed Source Form ........................................................... 2-8Initial Line ..................................................................... 2-9Continuation Line ......................................................... 2-9Comment Line............................................................ 2-10Tab-format Lines ........................................................ 2-10</p><p>Free Source Form........................................................... 2-10Source Lines .............................................................. 2-10Statement Labels........................................................ 2-11Spaces ....................................................................... 2-11Examples Using Spaces ............................................ 2-11Comments .................................................................. 2-12Statement Continuation .............................................. 2-12Example of Statement Continuation ........................... 2-13</p><p>Intersection Source Form................................................ 2-13INCLUDE Line ..................................................................... 2-14</p><p>Example of INCLUDE Lines....................................... 2-15</p><p>Chapter 3 Data Types and Data ObjectsTerminology ........................................................................... 3-1Intrinsic Data Types ............................................................... 3-2Derived Types........................................................................ 3-4Type Declarations .................................................................. 3-5</p><p>Examples of Type Declarations ........................................ 3-7Alternative Form of Intrinsic Type Spec Declaration ......... 3-8</p><p>Alternative Form of Initialization Within Declaration ..... 3-9Increasing Default Sizes .............................................. 3-9</p><p>Intrinsic Inquiry Functions ................................................. 3-9Attributes......................................................................... 3-10</p></li><li><p>Contents</p><p>vii</p><p>Representation of Literal Constants ..................................... 3-11Integer Constants ............................................................ 3-11</p><p>BOZ Constants .......................................................... 3-12Real Constants ............................................................... 3-13Complex Constants ........................................................ 3-14Character Constants....................................................... 3-14Logical Constants ........................................................... 3-16Typeless Constants ........................................................ 3-16</p><p>Extended Use of BOZ Constants............................... 3-17Hollerith Constants .................................................... 3-18</p><p>Character Substrings .......................................................... 3-19Derived-type Definition........................................................ 3-20</p><p>Structure Constructor ..................................................... 3-22Implicit and Explicit Typing .................................................. 3-22</p><p>IMPLICIT Statement .................................................. 3-23Data Initialization................................................................. 3-24Storage Association and Alignment .................................... 3-25</p><p>Storage Association Alignment Rule .............................. 3-25Dynamic Data Objects......................................................... 3-26</p><p>Allocatable Arrays........................................................... 3-27Pointers .......................................................................... 3-27</p><p>CRAY*-Style Pointers ................................................ 3-27Automatic Objects .......................................................... 3-28</p><p>Records and Structures....................................................... 3-28</p><p>Chapter 4 ArraysNew Features........................................................................ 4-1Array Properties .................................................................... 4-3Array Declaration .................................................................. 4-4</p><p>Syntax............................................................................... 4-5Examples of Array Specifiers ........................................... 4-5Array Element Storage Order ........................................... 4-6</p></li><li><p>viii</p><p>Intel Fortran Programmers Reference</p><p>Array Categories.................................................................... 4-7Explicit-shape Arrays ........................................................ 4-7Assumed-shape Arrays..................................................... 4-9Deferred-shape Arrays.................................................... 4-12</p><p>Pointer Arrays ............................................................ 4-12Allocatable Arrays ...................................................... 4-13</p><p>Assumed-size Arrays ...................................................... 4-15Whole Arrays and Array Subobjects.................................... 4-16</p><p>Array Elements ............................................................... 4-17Whole Arrays .................................................................. 4-19Array Sections................................................................. 4-20</p><p>Section Subscript List................................................. 4-20Array of Derived-type Components ............................ 4-25Array of Character Substrings.................................... 4-27</p><p>Array Constructors............................................................... 4-27Syntax ............................................................................. 4-28</p><p>Zero-sized Arrays ............................................................... 4-30Array Expressions................................................................ 4-31Array Functions.................................................................... 4-34</p><p>Intrinsic Functions ........................................................... 4-34User-defined Functions................................................... 4-35</p><p>Array Inquiry Functions........................................................ 4-36</p><p>Chapter 5 Expressions and AssignmentExpressions .......................................................................... 5-1</p><p>Formation of Expressions ................................................. 5-3Primary ......................................................................... 5-3Operators ..................................................................... 5-4Precedence of Operators ............................................. 5-5Special Forms of Expression........................................ 5-7Constant Expression .................................................... 5-7Initialization Expression................................................ 5-8</p></li><li><p>Contents</p><p>ix</p><p>Specification Expression............................................ 5-10Interpretation of Expressions.......................................... 5-12</p><p>Intrinsic Operators ..................................................... 5-12Array Operands ......................................................... 5-14Example..................................................................... 5-14Evaluation of Expressions ......................................... 5-15Logical Operators and Integer Operands .................. 5-15Arithmetic Operators and Logical Operands.............. 5-15</p><p>Assignment ......................................................................... 5-17Assignment Statement.................................................... 5-17</p><p>Intrinsic Assignment................................................... 5-18Examples of Intrinsic Assignment.............................. 5-19</p><p>Pointer Assignment ........................................................ 5-20Examples of Pointer Assignment............................... 5-21</p><p>Masked Array Assignment ............................................. 5-21Examples of Mask Array Assignment ........................ 5-23</p><p>Chapter 6 Execution ControlControl Constructs and Statement Blocks............................. 6-1CASE Construct .................................................................... 6-3</p><p>DO Construct.................................................................... 6-5Counter-controlled DO Loop......................................... 6-5Conditional DO Loop .................................................... 6-7Infinite DO Loop........................................................... 6-8</p><p>FORALL Construct and Statement ................................... 6-9IF Construct .................................................................... 6-14</p><p>Flow Control Statements ..................................................... 6-15CONTINUE Statement.................................................... 6-16CYCLE Statement .......................................................... 6-16EXIT Statement .............................................................. 6-17Assigned GO TO Statement ........................................... 6-18Computed GO TO Statement ......................................... 6-19</p></li><li><p>x</p><p>Intel Fortran Programmers Reference</p><p>Unconditional GO TO Statement..................................... 6-20Arithmetic IF Statement................................................... 6-21Logical IF Statement ....................................................... 6-21PAUSE Statement ........................................................... 6-22STOP Statement ............................................................. 6-23</p><p>Chapter 7 Program Units and ProceduresOverview................................................................................ 7-1</p><p>Program Units ................................................................... 7-1Program Unit Concepts ................................................ 7-2</p><p>Procedures........................................................................ 7-2Scope and Association ..................................................... 7-3</p><p>Scope ........................................................................... 7-3Association ................................................................... 7-3</p><p>Procedures ............................................................................ 7-5Procedure Categories ....................................................... 7-6</p><p>Intrinsic Procedures ..........................</p></li></ul>