using gnu fortran - gnu compiler collection gnu fortran and gcc. part i: invoking gnu fortran. 2...

Download Using GNU Fortran - GNU Compiler Collection  GNU Fortran and GCC. Part I: Invoking GNU Fortran. 2 GNU Fortran Command Options. Fortran: 2.4 Options for debugging your program or GNU Fortran. 5

Post on 08-May-2018

236 views

Category:

Documents

11 download

Embed Size (px)

TRANSCRIPT

  • Using GNU FortranFor gcc version 4.2.4

    The gfortran team

  • Published by the Free Software Foundation51 Franklin Street, Fifth FloorBoston, MA 02110-1301, USA

    Copyright c 1999-2007 Free Software Foundation, Inc.Permission is granted to copy, distribute and/or modify this document under the terms ofthe GNU Free Documentation License, Version 1.1 or any later version published by theFree Software Foundation; with the Invariant Sections being GNU General Public Licenseand Funding Free Software, the Front-Cover texts being (a) (see below), and with theBack-Cover Texts being (b) (see below). A copy of the license is included in the sectionentitled GNU Free Documentation License.(a) The FSFs Front-Cover Text is:A GNU Manual(b) The FSFs Back-Cover Text is:You have freedom to copy and modify this GNU Manual, like GNU software. Copiespublished by the Free Software Foundation raise funds for GNU development.

  • i

    Short Contents

    1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1

    Part I: Invoking GNU Fortran . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52 GNU Fortran Command Options . . . . . . . . . . . . . . . . . . . . . . . . 73 Runtime: Influencing runtime behavior with environment

    variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17

    Part II: Language Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 214 Fortran 2003 Status . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 235 Extensions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 256 Intrinsic Procedures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33

    Contributing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 151GNU General Public License . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 155GNU Free Documentation License . . . . . . . . . . . . . . . . . . . . . . . . . 167Funding Free Software . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 175Option Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 177Keyword Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 179

  • iii

    Table of Contents

    1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11.1 About GNU Fortran . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11.2 GNU Fortran and GCC . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21.3 GNU Fortran and G77 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21.4 Project Status . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31.5 Standards . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3

    Part I: Invoking GNU Fortran . . . . . . . . . . . . . . . . . . . . 5

    2 GNU Fortran Command Options . . . . . . . . . . . . . 72.1 Option summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72.2 Options controlling Fortran dialect . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82.3 Options to request or suppress errors and warnings . . . . . . . . . . . . . 92.4 Options for debugging your program or GNU Fortran . . . . . . . . . . 122.5 Options for directory search . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 122.6 Influencing runtime behavior . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 122.7 Options for code generation conventions . . . . . . . . . . . . . . . . . . . . . . . 132.8 Environment variables affecting gfortran . . . . . . . . . . . . . . . . . . . . . 16

    3 Runtime: Influencing runtime behavior withenvironment variables . . . . . . . . . . . . . . . . . . . . . . . . 17

    3.1 GFORTRAN_STDIN_UNITUnit number for standard input . . . . . . 173.2 GFORTRAN_STDOUT_UNITUnit number for standard output . . . . 173.3 GFORTRAN_STDERR_UNITUnit number for standard error . . . . . . 173.4 GFORTRAN_USE_STDERRSend library output to standard error

    . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 173.5 GFORTRAN_TMPDIRDirectory for scratch files . . . . . . . . . . . . . . . . . . 173.6 GFORTRAN_UNBUFFERED_ALLDont buffer output . . . . . . . . . . . . . . 173.7 GFORTRAN_SHOW_LOCUSShow location for runtime errors . . . . . . 173.8 GFORTRAN_OPTIONAL_PLUSPrint leading + where permitted . . 173.9 GFORTRAN_DEFAULT_RECLDefault record length for new files . . 183.10 GFORTRAN_LIST_SEPARATORSeparator for list output . . . . . . . . 183.11 GFORTRAN_CONVERT_UNITSet endianness for unformatted I/O

    . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18

    Part II: Language Reference . . . . . . . . . . . . . . . . . . . . . 21

    4 Fortran 2003 Status . . . . . . . . . . . . . . . . . . . . . . . . . . . 23

  • iv The GNU Fortran Compiler

    5 Extensions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 255.1 Old-style kind specifications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 255.2 Old-style variable initialization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 255.3 Extensions to namelist . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 265.4 X format descriptor without count field . . . . . . . . . . . . . . . . . . . . . . . . 265.5 Commas in FORMAT specifications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 275.6 Missing period in FORMAT specifications . . . . . . . . . . . . . . . . . . . . . . . . 275.7 I/O item lists . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 275.8 BOZ literal constants . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 275.9 Real array indices . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 275.10 Unary operators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 285.11 Implicitly convert LOGICAL and INTEGER values . . . . . . . . . . . . . . . 285.12 Hollerith constants support . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 285.13 Cray pointers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 285.14 CONVERT specifier . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 305.15 OpenMP . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31

    6 Intrinsic Procedures . . . . . . . . . . . . . . . . . . . . . . . . . . . 336.1 Introduction to intrinsic procedures . . . . . . . . . . . . . . . . . . . . . . . . . . . 336.2 ABORT Abort the program . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 336.3 ABS Absolute value . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 346.4 ACCESS Checks file access modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . 346.5 ACHAR Character in ASCII collating sequence . . . . . . . . . . . . . . . . 356.6 ACOS Arccosine function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 366.7 ACOSH Hyperbolic arccosine function . . . . . . . . . . . . . . . . . . . . . . . . 366.8 ADJUSTL Left adjust a string . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 376.9 ADJUSTR Right adjust a string . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 376.10 AIMAG Imaginary part of complex number . . . . . . . . . . . . . . . . . 386.11 AINT Truncate to a whole number . . . . . . . . . . . . . . . . . . . . . . . . . 386.12 ALARM Execute a routine after a given delay . . . . . . . . . . . . . . . 396.13 ALL All values in MASK along DIM are true . . . . . . . . . . . . . . 406.14 ALLOCATED Status of an allocatable entity . . . . . . . . . . . . . . . . . 416.15 AND Bitwise logical AND . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 416.16 ANINT Nearest whole number . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 426.17 ANY Any value in MASK along DIM is true . . . . . . . . . . . . . . . 426.18 ASIN Arcsine function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 436.19 ASINH Hyperbolic arcsine function . . . . . . . . . . . . . . . . . . . . . . . . . 446.20 ASSOCIATED Status of a pointer or pointer/target pair . . . . . 446.21 ATAN Arctangent function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 456.22 ATAN2 Arctangent function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 466.23 ATANH Hyperbolic arctangent function . . . . . . . . . . . . . . . . . . . . . 466.24 BESJ0 Bessel function of the first kind of order 0 . . . . . . . . . . 476.25 BESJ1 Bessel function of the first kind of order 1 . . . . . . . . . . 486.26 BESJN Bessel function of the first kind . . . . . . . . . . . . . . . . . . . . . 486.27 BESY0 Bessel function of the second kind of order 0 . . . . . . . . 496.28 BESY1 Bessel function of the second kind of order 1 . . . . . . . . 496.29 BESYN Bessel function of the second kind . . . . . . . . . . . . . . . . . . 506.30 BIT_SIZE Bit size inquiry function . . . . . . . . . . . . . . . . . . . . . . . . 50

  • v

    6.31 BTEST Bit test function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 516.32 CEILING Integer ceiling function . . . . . . . . . . . .

Recommended

View more >