This is Info file f/g77.info, produced by Makeinfo version 1.68 from the input file ../../../src/gcc-2.95.3/gcc/f/g77.texi. INFO-DIR-SECTION Programming START-INFO-DIR-ENTRY * g77: (g77). The GNU Fortran compiler. END-INFO-DIR-ENTRY This file documents the use and the internals of the GNU Fortran (`g77') compiler. It corresponds to the GCC-2.95 version of `g77'. Published by the Free Software Foundation 59 Temple Place - Suite 330 Boston, MA 02111-1307 USA Copyright (C) 1995-1999 Free Software Foundation, Inc. Permission is granted to make and distribute verbatim copies of this manual provided the copyright notice and this permission notice are preserved on all copies. Permission is granted to copy and distribute modified versions of this manual under the conditions for verbatim copying, provided also that the sections entitled "GNU General Public License," "Funding for Free Software," and "Protect Your Freedom--Fight `Look And Feel'" are included exactly as in the original, and provided that the entire resulting derived work is distributed under the terms of a permission notice identical to this one. Permission is granted to copy and distribute translations of this manual into another language, under the above conditions for modified versions, except that the sections entitled "GNU General Public License," "Funding for Free Software," and "Protect Your Freedom--Fight `Look And Feel'", and this permission notice, may be included in translations approved by the Free Software Foundation instead of in the original English. Contributed by James Craig Burley (). Inspired by a first pass at translating `g77-0.5.16/f/DOC' that was contributed to Craig by David Ronis ().  File: g77.info, Node: Signal Intrinsic (subroutine), Next: Sin Intrinsic, Prev: Sign Intrinsic, Up: Table of Intrinsic Functions Signal Intrinsic (subroutine) ............................. CALL Signal(NUMBER, HANDLER, STATUS) NUMBER: `INTEGER'; scalar; INTENT(IN). HANDLER: Signal handler (`INTEGER FUNCTION' or `SUBROUTINE') or dummy/global `INTEGER(KIND=1)' scalar. STATUS: `INTEGER(KIND=7)'; OPTIONAL; scalar; INTENT(OUT). Intrinsic groups: `unix'. Description: If HANDLER is a an `EXTERNAL' routine, arranges for it to be invoked with a single integer argument (of system-dependent length) when signal NUMBER occurs. If HANDLER is an integer, it can be used to turn off handling of signal NUMBER or revert to its default action. See `signal(2)'. Note that HANDLER will be called using C conventions, so the value of its argument in Fortran terms Fortran terms is obtained by applying `%LOC()' (or LOC()) to it. The value returned by `signal(2)' is written to STATUS, if that argument is supplied. Otherwise the return value is ignored. Some non-GNU implementations of Fortran provide this intrinsic as only a function, not as a subroutine, or do not support the (optional) STATUS argument. *Warning:* Use of the `libf2c' run-time library function `signal_' directly (such as via `EXTERNAL SIGNAL') requires use of the `%VAL()' construct to pass an `INTEGER' value (such as `SIG_IGN' or `SIG_DFL') for the HANDLER argument. However, while `CALL SIGNAL(SIGNUM, %VAL(SIG_IGN))' works when `SIGNAL' is treated as an external procedure (and resolves, at link time, to `libf2c''s `signal_' routine), this construct is not valid when `SIGNAL' is recognized as the intrinsic of that name. Therefore, for maximum portability and reliability, code such references to the `SIGNAL' facility as follows: INTRINSIC SIGNAL ... CALL SIGNAL(SIGNUM, SIG_IGN) `g77' will compile such a call correctly, while other compilers will generally either do so as well or reject the `INTRINSIC SIGNAL' statement via a diagnostic, allowing you to take appropriate action. For information on other intrinsics with the same name: *Note Signal Intrinsic (function)::.  File: g77.info, Node: Sin Intrinsic, Next: SinH Intrinsic, Prev: Signal Intrinsic (subroutine), Up: Table of Intrinsic Functions Sin Intrinsic ............. Sin(X) Sin: `REAL' or `COMPLEX' function, the exact type being that of argument X. X: `REAL' or `COMPLEX'; scalar; INTENT(IN). Intrinsic groups: (standard FORTRAN 77). Description: Returns the sine of X, an angle measured in radians. *Note ASin Intrinsic::, for the inverse of this function.  File: g77.info, Node: SinH Intrinsic, Next: Sleep Intrinsic, Prev: Sin Intrinsic, Up: Table of Intrinsic Functions SinH Intrinsic .............. SinH(X) SinH: `REAL' function, the `KIND=' value of the type being that of argument X. X: `REAL'; scalar; INTENT(IN). Intrinsic groups: (standard FORTRAN 77). Description: Returns the hyperbolic sine of X.  File: g77.info, Node: Sleep Intrinsic, Next: Sngl Intrinsic, Prev: SinH Intrinsic, Up: Table of Intrinsic Functions Sleep Intrinsic ............... CALL Sleep(SECONDS) SECONDS: `INTEGER(KIND=1)'; scalar; INTENT(IN). Intrinsic groups: `unix'. Description: Causes the process to pause for SECONDS seconds. See `sleep(2)'.  File: g77.info, Node: Sngl Intrinsic, Next: Spacing Intrinsic, Prev: Sleep Intrinsic, Up: Table of Intrinsic Functions Sngl Intrinsic .............. Sngl(A) Sngl: `REAL(KIND=1)' function. A: `REAL(KIND=2)'; scalar; INTENT(IN). Intrinsic groups: (standard FORTRAN 77). Description: Archaic form of `REAL()' that is specific to one type for A. *Note Real Intrinsic::.  File: g77.info, Node: Spacing Intrinsic, Next: Spread Intrinsic, Prev: Sngl Intrinsic, Up: Table of Intrinsic Functions Spacing Intrinsic ................. This intrinsic is not yet implemented. The name is, however, reserved as an intrinsic. Use `EXTERNAL Spacing' to use this name for an external procedure.  File: g77.info, Node: Spread Intrinsic, Next: SqRt Intrinsic, Prev: Spacing Intrinsic, Up: Table of Intrinsic Functions Spread Intrinsic ................ This intrinsic is not yet implemented. The name is, however, reserved as an intrinsic. Use `EXTERNAL Spread' to use this name for an external procedure.  File: g77.info, Node: SqRt Intrinsic, Next: SRand Intrinsic, Prev: Spread Intrinsic, Up: Table of Intrinsic Functions SqRt Intrinsic .............. SqRt(X) SqRt: `REAL' or `COMPLEX' function, the exact type being that of argument X. X: `REAL' or `COMPLEX'; scalar; INTENT(IN). Intrinsic groups: (standard FORTRAN 77). Description: Returns the square root of X, which must not be negative. To calculate and represent the square root of a negative number, complex arithmetic must be used. For example, `SQRT(COMPLEX(X))'. The inverse of this function is `SQRT(X) * SQRT(X)'.  File: g77.info, Node: SRand Intrinsic, Next: Stat Intrinsic (subroutine), Prev: SqRt Intrinsic, Up: Table of Intrinsic Functions SRand Intrinsic ............... CALL SRand(SEED) SEED: `INTEGER'; scalar; INTENT(IN). Intrinsic groups: `unix'. Description: Reinitialises the generator with the seed in SEED. *Note IRand Intrinsic::. *Note Rand Intrinsic::.  File: g77.info, Node: Stat Intrinsic (subroutine), Next: Stat Intrinsic (function), Prev: SRand Intrinsic, Up: Table of Intrinsic Functions Stat Intrinsic (subroutine) ........................... CALL Stat(FILE, SARRAY, STATUS) FILE: `CHARACTER'; scalar; INTENT(IN). SARRAY: `INTEGER(KIND=1)'; DIMENSION(13); INTENT(OUT). STATUS: `INTEGER(KIND=1)'; OPTIONAL; scalar; INTENT(OUT). Intrinsic groups: `unix'. Description: Obtains data about the given file FILE and places them in the array SARRAY. A null character (`CHAR(0)') marks the end of the name in FILE--otherwise, trailing blanks in FILE are ignored. The values in this array are extracted from the `stat' structure as returned by `fstat(2)' q.v., as follows: 1. Device ID 2. Inode number 3. File mode 4. Number of links 5. Owner's uid 6. Owner's gid 7. ID of device containing directory entry for file (0 if not available) 8. File size (bytes) 9. Last access time 10. Last modification time 11. Last file status change time 12. Preferred I/O block size (-1 if not available) 13. Number of blocks allocated (-1 if not available) Not all these elements are relevant on all systems. If an element is not relevant, it is returned as 0. If the STATUS argument is supplied, it contains 0 on success or a non-zero error code upon return. Some non-GNU implementations of Fortran provide this intrinsic as only a function, not as a subroutine, or do not support the (optional) STATUS argument. For information on other intrinsics with the same name: *Note Stat Intrinsic (function)::.  File: g77.info, Node: Stat Intrinsic (function), Next: Sum Intrinsic, Prev: Stat Intrinsic (subroutine), Up: Table of Intrinsic Functions Stat Intrinsic (function) ......................... Stat(FILE, SARRAY) Stat: `INTEGER(KIND=1)' function. FILE: `CHARACTER'; scalar; INTENT(IN). SARRAY: `INTEGER(KIND=1)'; DIMENSION(13); INTENT(OUT). Intrinsic groups: `unix'. Description: Obtains data about the given file FILE and places them in the array SARRAY. A null character (`CHAR(0)') marks the end of the name in FILE--otherwise, trailing blanks in FILE are ignored. The values in this array are extracted from the `stat' structure as returned by `fstat(2)' q.v., as follows: 1. Device ID 2. Inode number 3. File mode 4. Number of links 5. Owner's uid 6. Owner's gid 7. ID of device containing directory entry for file (0 if not available) 8. File size (bytes) 9. Last access time 10. Last modification time 11. Last file status change time 12. Preferred I/O block size (-1 if not available) 13. Number of blocks allocated (-1 if not available) Not all these elements are relevant on all systems. If an element is not relevant, it is returned as 0. Returns 0 on success or a non-zero error code. For information on other intrinsics with the same name: *Note Stat Intrinsic (subroutine)::.  File: g77.info, Node: Sum Intrinsic, Next: SymLnk Intrinsic (subroutine), Prev: Stat Intrinsic (function), Up: Table of Intrinsic Functions Sum Intrinsic ............. This intrinsic is not yet implemented. The name is, however, reserved as an intrinsic. Use `EXTERNAL Sum' to use this name for an external procedure.  File: g77.info, Node: SymLnk Intrinsic (subroutine), Next: System Intrinsic (subroutine), Prev: Sum Intrinsic, Up: Table of Intrinsic Functions SymLnk Intrinsic (subroutine) ............................. CALL SymLnk(PATH1, PATH2, STATUS) PATH1: `CHARACTER'; scalar; INTENT(IN). PATH2: `CHARACTER'; scalar; INTENT(IN). STATUS: `INTEGER(KIND=1)'; OPTIONAL; scalar; INTENT(OUT). Intrinsic groups: `unix'. Description: Makes a symbolic link from file PATH1 to PATH2. A null character (`CHAR(0)') marks the end of the names in PATH1 and PATH2--otherwise, trailing blanks in PATH1 and PATH2 are ignored. If the STATUS argument is supplied, it contains 0 on success or a non-zero error code upon return (`ENOSYS' if the system does not provide `symlink(2)'). Some non-GNU implementations of Fortran provide this intrinsic as only a function, not as a subroutine, or do not support the (optional) STATUS argument. For information on other intrinsics with the same name: *Note SymLnk Intrinsic (function)::.  File: g77.info, Node: System Intrinsic (subroutine), Next: System_Clock Intrinsic, Prev: SymLnk Intrinsic (subroutine), Up: Table of Intrinsic Functions System Intrinsic (subroutine) ............................. CALL System(COMMAND, STATUS) COMMAND: `CHARACTER'; scalar; INTENT(IN). STATUS: `INTEGER(KIND=1)'; OPTIONAL; scalar; INTENT(OUT). Intrinsic groups: `unix'. Description: Passes the command COMMAND to a shell (see `system(3)'). If argument STATUS is present, it contains the value returned by `system(3)', presumably 0 if the shell command succeeded. Note that which shell is used to invoke the command is system-dependent and environment-dependent. Some non-GNU implementations of Fortran provide this intrinsic as only a function, not as a subroutine, or do not support the (optional) STATUS argument. For information on other intrinsics with the same name: *Note System Intrinsic (function)::.  File: g77.info, Node: System_Clock Intrinsic, Next: Tan Intrinsic, Prev: System Intrinsic (subroutine), Up: Table of Intrinsic Functions System_Clock Intrinsic ...................... CALL System_Clock(COUNT, RATE, MAX) COUNT: `INTEGER(KIND=1)'; scalar; INTENT(OUT). RATE: `INTEGER(KIND=1)'; OPTIONAL; scalar; INTENT(OUT). MAX: `INTEGER(KIND=1)'; OPTIONAL; scalar; INTENT(OUT). Intrinsic groups: `f90'. Description: Returns in COUNT the current value of the system clock; this is the value returned by the UNIX function `times(2)' in this implementation, but isn't in general. RATE is the number of clock ticks per second and MAX is the maximum value this can take, which isn't very useful in this implementation since it's just the maximum C `unsigned int' value. On some systems, the underlying timings are represented using types with sufficiently small limits that overflows (wraparounds) are possible, such as 32-bit types. Therefore, the values returned by this intrinsic might be, or become, negative, or numerically less than previous values, during a single run of the compiled program.  File: g77.info, Node: Tan Intrinsic, Next: TanH Intrinsic, Prev: System_Clock Intrinsic, Up: Table of Intrinsic Functions Tan Intrinsic ............. Tan(X) Tan: `REAL' function, the `KIND=' value of the type being that of argument X. X: `REAL'; scalar; INTENT(IN). Intrinsic groups: (standard FORTRAN 77). Description: Returns the tangent of X, an angle measured in radians. *Note ATan Intrinsic::, for the inverse of this function.  File: g77.info, Node: TanH Intrinsic, Next: Time Intrinsic (UNIX), Prev: Tan Intrinsic, Up: Table of Intrinsic Functions TanH Intrinsic .............. TanH(X) TanH: `REAL' function, the `KIND=' value of the type being that of argument X. X: `REAL'; scalar; INTENT(IN). Intrinsic groups: (standard FORTRAN 77). Description: Returns the hyperbolic tangent of X.  File: g77.info, Node: Time Intrinsic (UNIX), Next: Time8 Intrinsic, Prev: TanH Intrinsic, Up: Table of Intrinsic Functions Time Intrinsic (UNIX) ..................... Time() Time: `INTEGER(KIND=1)' function. Intrinsic groups: `unix'. Description: Returns the current time encoded as an integer (in the manner of the UNIX function `time(3)'). This value is suitable for passing to `CTIME', `GMTIME', and `LTIME'. This intrinsic is not fully portable, such as to systems with 32-bit `INTEGER' types but supporting times wider than 32 bits. Therefore, the values returned by this intrinsic might be, or become, negative, or numerically less than previous values, during a single run of the compiled program. *Note Time8 Intrinsic::, for information on a similar intrinsic that might be portable to more GNU Fortran implementations, though to fewer Fortran compilers. For information on other intrinsics with the same name: *Note Time Intrinsic (VXT)::.  File: g77.info, Node: Time8 Intrinsic, Next: Tiny Intrinsic, Prev: Time Intrinsic (UNIX), Up: Table of Intrinsic Functions Time8 Intrinsic ............... Time8() Time8: `INTEGER(KIND=2)' function. Intrinsic groups: `unix'. Description: Returns the current time encoded as a long integer (in the manner of the UNIX function `time(3)'). This value is suitable for passing to `CTIME', `GMTIME', and `LTIME'. *Warning:* this intrinsic does not increase the range of the timing values over that returned by `time(3)'. On a system with a 32-bit `time(3)', `TIME8' will return a 32-bit value, even though converted to an `INTEGER(KIND=2)' value. That means overflows of the 32-bit value can still occur. Therefore, the values returned by this intrinsic might be, or become, negative, or numerically less than previous values, during a single run of the compiled program. No Fortran implementations other than GNU Fortran are known to support this intrinsic at the time of this writing. *Note Time Intrinsic (UNIX)::, for information on a similar intrinsic that might be portable to more Fortran compilers, though to fewer GNU Fortran implementations.  File: g77.info, Node: Tiny Intrinsic, Next: Transfer Intrinsic, Prev: Time8 Intrinsic, Up: Table of Intrinsic Functions Tiny Intrinsic .............. This intrinsic is not yet implemented. The name is, however, reserved as an intrinsic. Use `EXTERNAL Tiny' to use this name for an external procedure.  File: g77.info, Node: Transfer Intrinsic, Next: Transpose Intrinsic, Prev: Tiny Intrinsic, Up: Table of Intrinsic Functions Transfer Intrinsic .................. This intrinsic is not yet implemented. The name is, however, reserved as an intrinsic. Use `EXTERNAL Transfer' to use this name for an external procedure.  File: g77.info, Node: Transpose Intrinsic, Next: Trim Intrinsic, Prev: Transfer Intrinsic, Up: Table of Intrinsic Functions Transpose Intrinsic ................... This intrinsic is not yet implemented. The name is, however, reserved as an intrinsic. Use `EXTERNAL Transpose' to use this name for an external procedure.  File: g77.info, Node: Trim Intrinsic, Next: TtyNam Intrinsic (subroutine), Prev: Transpose Intrinsic, Up: Table of Intrinsic Functions Trim Intrinsic .............. This intrinsic is not yet implemented. The name is, however, reserved as an intrinsic. Use `EXTERNAL Trim' to use this name for an external procedure.  File: g77.info, Node: TtyNam Intrinsic (subroutine), Next: TtyNam Intrinsic (function), Prev: Trim Intrinsic, Up: Table of Intrinsic Functions TtyNam Intrinsic (subroutine) ............................. CALL TtyNam(UNIT, NAME) UNIT: `INTEGER'; scalar; INTENT(IN). NAME: `CHARACTER'; scalar; INTENT(OUT). Intrinsic groups: `unix'. Description: Sets NAME to the name of the terminal device open on logical unit UNIT or to a blank string if UNIT is not connected to a terminal. Some non-GNU implementations of Fortran provide this intrinsic as only a function, not as a subroutine. For information on other intrinsics with the same name: *Note TtyNam Intrinsic (function)::.  File: g77.info, Node: TtyNam Intrinsic (function), Next: UBound Intrinsic, Prev: TtyNam Intrinsic (subroutine), Up: Table of Intrinsic Functions TtyNam Intrinsic (function) ........................... TtyNam(UNIT) TtyNam: `CHARACTER*(*)' function. UNIT: `INTEGER'; scalar; INTENT(IN). Intrinsic groups: `unix'. Description: Returns the name of the terminal device open on logical unit UNIT or a blank string if UNIT is not connected to a terminal. For information on other intrinsics with the same name: *Note TtyNam Intrinsic (subroutine)::.  File: g77.info, Node: UBound Intrinsic, Next: UMask Intrinsic (subroutine), Prev: TtyNam Intrinsic (function), Up: Table of Intrinsic Functions UBound Intrinsic ................ This intrinsic is not yet implemented. The name is, however, reserved as an intrinsic. Use `EXTERNAL UBound' to use this name for an external procedure.  File: g77.info, Node: UMask Intrinsic (subroutine), Next: Unlink Intrinsic (subroutine), Prev: UBound Intrinsic, Up: Table of Intrinsic Functions UMask Intrinsic (subroutine) ............................ CALL UMask(MASK, OLD) MASK: `INTEGER'; scalar; INTENT(IN). OLD: `INTEGER(KIND=1)'; OPTIONAL; scalar; INTENT(OUT). Intrinsic groups: `unix'. Description: Sets the file creation mask to MASK and returns the old value in argument OLD if it is supplied. See `umask(2)'. Some non-GNU implementations of Fortran provide this intrinsic as only a function, not as a subroutine. For information on other intrinsics with the same name: *Note UMask Intrinsic (function)::.  File: g77.info, Node: Unlink Intrinsic (subroutine), Next: Unpack Intrinsic, Prev: UMask Intrinsic (subroutine), Up: Table of Intrinsic Functions Unlink Intrinsic (subroutine) ............................. CALL Unlink(FILE, STATUS) FILE: `CHARACTER'; scalar; INTENT(IN). STATUS: `INTEGER(KIND=1)'; OPTIONAL; scalar; INTENT(OUT). Intrinsic groups: `unix'. Description: Unlink the file FILE. A null character (`CHAR(0)') marks the end of the name in FILE--otherwise, trailing blanks in FILE are ignored. If the STATUS argument is supplied, it contains 0 on success or a non-zero error code upon return. See `unlink(2)'. Some non-GNU implementations of Fortran provide this intrinsic as only a function, not as a subroutine, or do not support the (optional) STATUS argument. For information on other intrinsics with the same name: *Note Unlink Intrinsic (function)::.  File: g77.info, Node: Unpack Intrinsic, Next: Verify Intrinsic, Prev: Unlink Intrinsic (subroutine), Up: Table of Intrinsic Functions Unpack Intrinsic ................ This intrinsic is not yet implemented. The name is, however, reserved as an intrinsic. Use `EXTERNAL Unpack' to use this name for an external procedure.  File: g77.info, Node: Verify Intrinsic, Next: XOr Intrinsic, Prev: Unpack Intrinsic, Up: Table of Intrinsic Functions Verify Intrinsic ................ This intrinsic is not yet implemented. The name is, however, reserved as an intrinsic. Use `EXTERNAL Verify' to use this name for an external procedure.  File: g77.info, Node: XOr Intrinsic, Next: ZAbs Intrinsic, Prev: Verify Intrinsic, Up: Table of Intrinsic Functions XOr Intrinsic ............. XOr(I, J) XOr: `INTEGER' or `LOGICAL' function, the exact type being the result of cross-promoting the types of all the arguments. I: `INTEGER' or `LOGICAL'; scalar; INTENT(IN). J: `INTEGER' or `LOGICAL'; scalar; INTENT(IN). Intrinsic groups: `f2c'. Description: Returns value resulting from boolean exclusive-OR of pair of bits in each of I and J.  File: g77.info, Node: ZAbs Intrinsic, Next: ZCos Intrinsic, Prev: XOr Intrinsic, Up: Table of Intrinsic Functions ZAbs Intrinsic .............. ZAbs(A) ZAbs: `REAL(KIND=2)' function. A: `COMPLEX(KIND=2)'; scalar; INTENT(IN). Intrinsic groups: `f2c'. Description: Archaic form of `ABS()' that is specific to one type for A. *Note Abs Intrinsic::.  File: g77.info, Node: ZCos Intrinsic, Next: ZExp Intrinsic, Prev: ZAbs Intrinsic, Up: Table of Intrinsic Functions ZCos Intrinsic .............. ZCos(X) ZCos: `COMPLEX(KIND=2)' function. X: `COMPLEX(KIND=2)'; scalar; INTENT(IN). Intrinsic groups: `f2c'. Description: Archaic form of `COS()' that is specific to one type for X. *Note Cos Intrinsic::.  File: g77.info, Node: ZExp Intrinsic, Next: ZLog Intrinsic, Prev: ZCos Intrinsic, Up: Table of Intrinsic Functions ZExp Intrinsic .............. ZExp(X) ZExp: `COMPLEX(KIND=2)' function. X: `COMPLEX(KIND=2)'; scalar; INTENT(IN). Intrinsic groups: `f2c'. Description: Archaic form of `EXP()' that is specific to one type for X. *Note Exp Intrinsic::.  File: g77.info, Node: ZLog Intrinsic, Next: ZSin Intrinsic, Prev: ZExp Intrinsic, Up: Table of Intrinsic Functions ZLog Intrinsic .............. ZLog(X) ZLog: `COMPLEX(KIND=2)' function. X: `COMPLEX(KIND=2)'; scalar; INTENT(IN). Intrinsic groups: `f2c'. Description: Archaic form of `LOG()' that is specific to one type for X. *Note Log Intrinsic::.  File: g77.info, Node: ZSin Intrinsic, Next: ZSqRt Intrinsic, Prev: ZLog Intrinsic, Up: Table of Intrinsic Functions ZSin Intrinsic .............. ZSin(X) ZSin: `COMPLEX(KIND=2)' function. X: `COMPLEX(KIND=2)'; scalar; INTENT(IN). Intrinsic groups: `f2c'. Description: Archaic form of `SIN()' that is specific to one type for X. *Note Sin Intrinsic::.  File: g77.info, Node: ZSqRt Intrinsic, Prev: ZSin Intrinsic, Up: Table of Intrinsic Functions ZSqRt Intrinsic ............... ZSqRt(X) ZSqRt: `COMPLEX(KIND=2)' function. X: `COMPLEX(KIND=2)'; scalar; INTENT(IN). Intrinsic groups: `f2c'. Description: Archaic form of `SQRT()' that is specific to one type for X. *Note SqRt Intrinsic::.  File: g77.info, Node: Scope and Classes of Names, Next: I/O, Prev: Functions and Subroutines, Up: Language Scope and Classes of Symbolic Names =================================== (The following information augments or overrides the information in Chapter 18 of ANSI X3.9-1978 FORTRAN 77 in specifying the GNU Fortran language. Chapter 18 of that document otherwise serves as the basis for the relevant aspects of GNU Fortran.) * Menu: * Underscores in Symbol Names::  File: g77.info, Node: Underscores in Symbol Names, Up: Scope and Classes of Names Underscores in Symbol Names --------------------------- Underscores (`_') are accepted in symbol names after the first character (which must be a letter).  File: g77.info, Node: I/O, Next: Fortran 90 Features, Prev: Scope and Classes of Names, Up: Language I/O === A dollar sign at the end of an output format specification suppresses the newline at the end of the output. Edit descriptors in `FORMAT' statements may contain compile-time `INTEGER' constant expressions in angle brackets, such as 10 FORMAT (I) The `OPEN' specifier `NAME=' is equivalent to `FILE='. These Fortran 90 features are supported: * The `O' and `Z' edit descriptors are supported for I/O of integers in octal and hexadecimal formats, respectively. * The `FILE=' specifier may be omitted in an `OPEN' statement if `STATUS='SCRATCH'' is supplied. The `STATUS='REPLACE'' specifier is supported.  File: g77.info, Node: Fortran 90 Features, Prev: I/O, Up: Language Fortran 90 Features =================== For convenience this section collects a list (probably incomplete) of the Fortran 90 features supported by the GNU Fortran language, even if they are documented elsewhere. *Note Characters, Lines, and Execution Sequence: Characters Lines Sequence, for information on additional fixed source form lexical issues. Further, the free source form is supported through the `-ffree-form' option. Other Fortran 90 features can be turned on by the `-ff90' option; see *Note Fortran 90::. For information on the Fortran 90 intrinsics available, see *Note Table of Intrinsic Functions::. Automatic arrays in procedures Character assignments In character assignments, the variable being assigned may occur on the right hand side of the assignment. Character strings Strings may have zero length and substrings of character constants are permitted. Character constants may be enclosed in double quotes (`"') as well as single quotes. *Note Character Type::. Construct names (Symbolic tags on blocks.) *Note Construct Names::. `CYCLE' and `EXIT' *Note The `CYCLE' and `EXIT' Statements: CYCLE and EXIT. `DOUBLE COMPLEX' *Note `DOUBLE COMPLEX' Statement: DOUBLE COMPLEX. `DO WHILE' *Note DO WHILE::. `END' decoration *Note Statements::. `END DO' *Note END DO::. `KIND' `IMPLICIT NONE' `INCLUDE' statements *Note INCLUDE::. List-directed and namelist I/O on internal files Binary, octal and hexadecimal constants These are supported more generally than required by Fortran 90. *Note Integer Type::. `O' and `Z' edit descriptors `NAMELIST' *Note NAMELIST::. `OPEN' specifiers `STATUS='REPLACE'' is supported. The `FILE=' specifier may be omitted in an `OPEN' statement if `STATUS='SCRATCH'' is supplied. `FORMAT' edit descriptors The `Z' edit descriptor is supported. Relational operators The operators `<', `<=', `==', `/=', `>' and `>=' may be used instead of `.LT.', `.LE.', `.EQ.', `.NE.', `.GT.' and `.GE.' respectively. `SELECT CASE' Not fully implemented. *Note `SELECT CASE' on `CHARACTER' Type: SELECT CASE on CHARACTER Type. Specification statements A limited subset of the Fortran 90 syntax and semantics for variable declarations is supported, including `KIND'. *Note Kind Notation::. (`KIND' is of limited usefulness in the absence of the `KIND'-related intrinsics, since these intrinsics permit writing more widely portable code.) An example of supported `KIND' usage is: INTEGER (KIND=1) :: FOO=1, BAR=2 CHARACTER (LEN=3) FOO `PARAMETER' and `DIMENSION' attributes aren't supported.  File: g77.info, Node: Other Dialects, Next: Other Compilers, Prev: Compiler, Up: Top Other Dialects ************** GNU Fortran supports a variety of features that are not considered part of the GNU Fortran language itself, but are representative of various dialects of Fortran that `g77' supports in whole or in part. Any of the features listed below might be disallowed by `g77' unless some command-line option is specified. Currently, some of the features are accepted using the default invocation of `g77', but that might change in the future. *Note: This portion of the documentation definitely needs a lot of work!* * Menu: * Source Form:: Details of fixed-form and free-form source. * Trailing Comment:: Use of `/*' to start a comment. * Debug Line:: Use of `D' in column 1. * Dollar Signs:: Use of `$' in symbolic names. * Case Sensitivity:: Uppercase and lowercase in source files. * VXT Fortran:: ...versus the GNU Fortran language. * Fortran 90:: ...versus the GNU Fortran language. * Pedantic Compilation:: Enforcing the standard. * Distensions:: Misfeatures supported by GNU Fortran.  File: g77.info, Node: Source Form, Next: Trailing Comment, Up: Other Dialects Source Form =========== GNU Fortran accepts programs written in either fixed form or free form. Fixed form corresponds to ANSI FORTRAN 77 (plus popular extensions, such as allowing tabs) and Fortran 90's fixed form. Free form corresponds to Fortran 90's free form (though possibly not entirely up-to-date, and without complaining about some things that for which Fortran 90 requires diagnostics, such as the spaces in the constant in `R = 3 . 1'). The way a Fortran compiler views source files depends entirely on the implementation choices made for the compiler, since those choices are explicitly left to the implementation by the published Fortran standards. GNU Fortran currently tries to be somewhat like a few popular compilers (`f2c', Digital ("DEC") Fortran, and so on), though a cleaner default definition along with more flexibility offered by command-line options is likely to be offered in version 0.6. This section describes how `g77' interprets source lines. * Menu: * Carriage Returns:: Carriage returns ignored. * Tabs:: Tabs converted to spaces. * Short Lines:: Short lines padded with spaces (fixed-form only). * Long Lines:: Long lines truncated. * Ampersands:: Special Continuation Lines.  File: g77.info, Node: Carriage Returns, Next: Tabs, Up: Source Form Carriage Returns ---------------- Carriage returns (`\r') in source lines are ignored. This is somewhat different from `f2c', which seems to treat them as spaces outside character/Hollerith constants, and encodes them as `\r' inside such constants.  File: g77.info, Node: Tabs, Next: Short Lines, Prev: Carriage Returns, Up: Source Form Tabs ---- A source line with a character anywhere in it is treated as entirely significant--however long it is--instead of ending in column 72 (for fixed-form source) or 132 (for free-form source). This also is different from `f2c', which encodes tabs as `\t' (the ASCII character) inside character and Hollerith constants, but nevertheless seems to treat the column position as if it had been affected by the canonical tab positioning. `g77' effectively translates tabs to the appropriate number of spaces (a la the default for the UNIX `expand' command) before doing any other processing, other than (currently) noting whether a tab was found on a line and using this information to decide how to interpret the length of the line and continued constants. Note that this default behavior probably will change for version 0.6, when it will presumably be available via a command-line option. The default as of version 0.6 is planned to be a "pure visual" model, where tabs are immediately converted to spaces and otherwise have no effect, so the way a typical user sees source lines produces a consistent result no matter how the spacing in those source lines is actually implemented via tabs, spaces, and trailing tabs/spaces before newline. Command-line options are likely to be added to specify whether all or just-tabbed lines are to be extended to 132 or full input-line length, and perhaps even an option will be added to specify the truncated-line behavior to which some Digital compilers default (and which affects the way continued character/Hollerith constants are interpreted).  File: g77.info, Node: Short Lines, Next: Long Lines, Prev: Tabs, Up: Source Form Short Lines ----------- Source lines shorter than the applicable fixed-form length are treated as if they were padded with spaces to that length. (None of this is relevant to source files written in free form.) This affects only continued character and Hollerith constants, and is a different interpretation than provided by some other popular compilers (although a bit more consistent with the traditional punched-card basis of Fortran and the way the Fortran standard expressed fixed source form). `g77' might someday offer an option to warn about cases where differences might be seen as a result of this treatment, and perhaps an option to specify the alternate behavior as well. Note that this padding cannot apply to lines that are effectively of infinite length--such lines are specified using command-line options like `-ffixed-line-length-none', for example.  File: g77.info, Node: Long Lines, Next: Ampersands, Prev: Short Lines, Up: Source Form Long Lines ---------- Source lines longer than the applicable length are truncated to that length. Currently, `g77' does not warn if the truncated characters are not spaces, to accommodate existing code written for systems that treated truncated text as commentary (especially in columns 73 through 80). *Note Options Controlling Fortran Dialect: Fortran Dialect Options, for information on the `-ffixed-line-length-N' option, which can be used to set the line length applicable to fixed-form source files.  File: g77.info, Node: Ampersands, Prev: Long Lines, Up: Source Form Ampersand Continuation Line --------------------------- A `&' in column 1 of fixed-form source denotes an arbitrary-length continuation line, imitating the behavior of `f2c'.  File: g77.info, Node: Trailing Comment, Next: Debug Line, Prev: Source Form, Up: Other Dialects Trailing Comment ================ `g77' supports use of `/*' to start a trailing comment. In the GNU Fortran language, `!' is used for this purpose. `/*' is not in the GNU Fortran language because the use of `/*' in a program might suggest to some readers that a block, not trailing, comment is started (and thus ended by `*/', not end of line), since that is the meaning of `/*' in C. Also, such readers might think they can use `//' to start a trailing comment as an alternative to `/*', but `//' already denotes concatenation, and such a "comment" might actually result in a program that compiles without error (though it would likely behave incorrectly).  File: g77.info, Node: Debug Line, Next: Dollar Signs, Prev: Trailing Comment, Up: Other Dialects Debug Line ========== Use of `D' or `d' as the first character (column 1) of a source line denotes a debug line. In turn, a debug line is treated as either a comment line or a normal line, depending on whether debug lines are enabled. When treated as a comment line, a line beginning with `D' or `d' is treated as if it the first character was `C' or `c', respectively. When treated as a normal line, such a line is treated as if the first character was (space). (Currently, `g77' provides no means for treating debug lines as normal lines.)  File: g77.info, Node: Dollar Signs, Next: Case Sensitivity, Prev: Debug Line, Up: Other Dialects Dollar Signs in Symbol Names ============================ Dollar signs (`$') are allowed in symbol names (after the first character) when the `-fdollar-ok' option is specified.  File: g77.info, Node: Case Sensitivity, Next: VXT Fortran, Prev: Dollar Signs, Up: Other Dialects Case Sensitivity ================ GNU Fortran offers the programmer way too much flexibility in deciding how source files are to be treated vis-a-vis uppercase and lowercase characters. There are 66 useful settings that affect case sensitivity, plus 10 settings that are nearly useless, with the remaining 116 settings being either redundant or useless. None of these settings have any effect on the contents of comments (the text after a `c' or `C' in Column 1, for example) or of character or Hollerith constants. Note that things like the `E' in the statement `CALL FOO(3.2E10)' and the `TO' in `ASSIGN 10 TO LAB' are considered built-in keywords, and so are affected by these settings. Low-level switches are identified in this section as follows: A Source Case Conversion: 0 Preserve (see Note 1) 1 Convert to Upper Case 2 Convert to Lower Case B Built-in Keyword Matching: 0 Match Any Case (per-character basis) 1 Match Upper Case Only 2 Match Lower Case Only 3 Match InitialCaps Only (see tables for spellings) C Built-in Intrinsic Matching: 0 Match Any Case (per-character basis) 1 Match Upper Case Only 2 Match Lower Case Only 3 Match InitialCaps Only (see tables for spellings) D User-defined Symbol Possibilities (warnings only): 0 Allow Any Case (per-character basis) 1 Allow Upper Case Only 2 Allow Lower Case Only 3 Allow InitialCaps Only (see Note 2) Note 1: `g77' eventually will support `NAMELIST' in a manner that is consistent with these source switches--in the sense that input will be expected to meet the same requirements as source code in terms of matching symbol names and keywords (for the exponent letters). Currently, however, `NAMELIST' is supported by `libg2c', which uppercases `NAMELIST' input and symbol names for matching. This means not only that `NAMELIST' output currently shows symbol (and keyword) names in uppercase even if lower-case source conversion (option A2) is selected, but that `NAMELIST' cannot be adequately supported when source case preservation (option A0) is selected. If A0 is selected, a warning message will be output for each `NAMELIST' statement to this effect. The behavior of the program is undefined at run time if two or more symbol names appear in a given `NAMELIST' such that the names are identical when converted to upper case (e.g. `NAMELIST /X/ VAR, Var, var'). For complete and total elegance, perhaps there should be a warning when option A2 is selected, since the output of NAMELIST is currently in uppercase but will someday be lowercase (when a `libg77' is written), but that seems to be overkill for a product in beta test. Note 2: Rules for InitialCaps names are: - Must be a single uppercase letter, *or* - Must start with an uppercase letter and contain at least one lowercase letter. So `A', `Ab', `ABc', `AbC', and `Abc' are valid InitialCaps names, but `AB', `A2', and `ABC' are not. Note that most, but not all, built-in names meet these requirements--the exceptions are some of the two-letter format specifiers, such as `BN' and `BZ'. Here are the names of the corresponding command-line options: A0: -fsource-case-preserve A1: -fsource-case-upper A2: -fsource-case-lower B0: -fmatch-case-any B1: -fmatch-case-upper B2: -fmatch-case-lower B3: -fmatch-case-initcap C0: -fintrin-case-any C1: -fintrin-case-upper C2: -fintrin-case-lower C3: -fintrin-case-initcap D0: -fsymbol-case-any D1: -fsymbol-case-upper D2: -fsymbol-case-lower D3: -fsymbol-case-initcap Useful combinations of the above settings, along with abbreviated option names that set some of these combinations all at once: 1: A0-- B0--- C0--- D0--- -fcase-preserve 2: A0-- B0--- C0--- D-1-- 3: A0-- B0--- C0--- D--2- 4: A0-- B0--- C0--- D---3 5: A0-- B0--- C-1-- D0--- 6: A0-- B0--- C-1-- D-1-- 7: A0-- B0--- C-1-- D--2- 8: A0-- B0--- C-1-- D---3 9: A0-- B0--- C--2- D0--- 10: A0-- B0--- C--2- D-1-- 11: A0-- B0--- C--2- D--2- 12: A0-- B0--- C--2- D---3 13: A0-- B0--- C---3 D0--- 14: A0-- B0--- C---3 D-1-- 15: A0-- B0--- C---3 D--2- 16: A0-- B0--- C---3 D---3 17: A0-- B-1-- C0--- D0--- 18: A0-- B-1-- C0--- D-1-- 19: A0-- B-1-- C0--- D--2- 20: A0-- B-1-- C0--- D---3 21: A0-- B-1-- C-1-- D0--- 22: A0-- B-1-- C-1-- D-1-- -fcase-strict-upper 23: A0-- B-1-- C-1-- D--2- 24: A0-- B-1-- C-1-- D---3 25: A0-- B-1-- C--2- D0--- 26: A0-- B-1-- C--2- D-1-- 27: A0-- B-1-- C--2- D--2- 28: A0-- B-1-- C--2- D---3 29: A0-- B-1-- C---3 D0--- 30: A0-- B-1-- C---3 D-1-- 31: A0-- B-1-- C---3 D--2- 32: A0-- B-1-- C---3 D---3 33: A0-- B--2- C0--- D0--- 34: A0-- B--2- C0--- D-1-- 35: A0-- B--2- C0--- D--2- 36: A0-- B--2- C0--- D---3 37: A0-- B--2- C-1-- D0--- 38: A0-- B--2- C-1-- D-1-- 39: A0-- B--2- C-1-- D--2- 40: A0-- B--2- C-1-- D---3 41: A0-- B--2- C--2- D0--- 42: A0-- B--2- C--2- D-1-- 43: A0-- B--2- C--2- D--2- -fcase-strict-lower 44: A0-- B--2- C--2- D---3 45: A0-- B--2- C---3 D0--- 46: A0-- B--2- C---3 D-1-- 47: A0-- B--2- C---3 D--2- 48: A0-- B--2- C---3 D---3 49: A0-- B---3 C0--- D0--- 50: A0-- B---3 C0--- D-1-- 51: A0-- B---3 C0--- D--2- 52: A0-- B---3 C0--- D---3 53: A0-- B---3 C-1-- D0--- 54: A0-- B---3 C-1-- D-1-- 55: A0-- B---3 C-1-- D--2- 56: A0-- B---3 C-1-- D---3 57: A0-- B---3 C--2- D0--- 58: A0-- B---3 C--2- D-1-- 59: A0-- B---3 C--2- D--2- 60: A0-- B---3 C--2- D---3 61: A0-- B---3 C---3 D0--- 62: A0-- B---3 C---3 D-1-- 63: A0-- B---3 C---3 D--2- 64: A0-- B---3 C---3 D---3 -fcase-initcap 65: A-1- B01-- C01-- D01-- -fcase-upper 66: A--2 B0-2- C0-2- D0-2- -fcase-lower Number 22 is the "strict" ANSI FORTRAN 77 model wherein all input (except comments, character constants, and Hollerith strings) must be entered in uppercase. Use `-fcase-strict-upper' to specify this combination. Number 43 is like Number 22 except all input must be lowercase. Use `-fcase-strict-lower' to specify this combination. Number 65 is the "classic" ANSI FORTRAN 77 model as implemented on many non-UNIX machines whereby all the source is translated to uppercase. Use `-fcase-upper' to specify this combination. Number 66 is the "canonical" UNIX model whereby all the source is translated to lowercase. Use `-fcase-lower' to specify this combination. There are a few nearly useless combinations: 67: A-1- B01-- C01-- D--2- 68: A-1- B01-- C01-- D---3 69: A-1- B01-- C--23 D01-- 70: A-1- B01-- C--23 D--2- 71: A-1- B01-- C--23 D---3 72: A--2 B01-- C0-2- D-1-- 73: A--2 B01-- C0-2- D---3 74: A--2 B01-- C-1-3 D0-2- 75: A--2 B01-- C-1-3 D-1-- 76: A--2 B01-- C-1-3 D---3 The above allow some programs to be compiled but with restrictions that make most useful programs impossible: Numbers 67 and 72 warn about *any* user-defined symbol names (such as `SUBROUTINE FOO'); Numbers 68 and 73 warn about any user-defined symbol names longer than one character that don't have at least one non-alphabetic character after the first; Numbers 69 and 74 disallow any references to intrinsics; and Numbers 70, 71, 75, and 76 are combinations of the restrictions in 67+69, 68+69, 72+74, and 73+74, respectively. All redundant combinations are shown in the above tables anyplace where more than one setting is shown for a low-level switch. For example, `B0-2-' means either setting 0 or 2 is valid for switch B. The "proper" setting in such a case is the one that copies the setting of switch A--any other setting might slightly reduce the speed of the compiler, though possibly to an unmeasurable extent. All remaining combinations are useless in that they prevent successful compilation of non-null source files (source files with something other than comments).  File: g77.info, Node: VXT Fortran, Next: Fortran 90, Prev: Case Sensitivity, Up: Other Dialects VXT Fortran =========== `g77' supports certain constructs that have different meanings in VXT Fortran than they do in the GNU Fortran language. Generally, this manual uses the invented term VXT Fortran to refer VAX FORTRAN (circa v4). That compiler offered many popular features, though not necessarily those that are specific to the VAX processor architecture, the VMS operating system, or Digital Equipment Corporation's Fortran product line. (VAX and VMS probably are trademarks of Digital Equipment Corporation.) An extension offered by a Digital Fortran product that also is offered by several other Fortran products for different kinds of systems is probably going to be considered for inclusion in `g77' someday, and is considered a VXT Fortran feature. The `-fvxt' option generally specifies that, where the meaning of a construct is ambiguous (means one thing in GNU Fortran and another in VXT Fortran), the VXT Fortran meaning is to be assumed. * Menu: * Double Quote Meaning:: `"2000' as octal constant. * Exclamation Point:: `!' in column 6.  File: g77.info, Node: Double Quote Meaning, Next: Exclamation Point, Up: VXT Fortran Meaning of Double Quote ----------------------- `g77' treats double-quote (`"') as beginning an octal constant of `INTEGER(KIND=1)' type when the `-fvxt' option is specified. The form of this octal constant is "OCTAL-DIGITS where OCTAL-DIGITS is a nonempty string of characters in the set `01234567'. For example, the `-fvxt' option permits this: PRINT *, "20 END The above program would print the value `16'. *Note Integer Type::, for information on the preferred construct for integer constants specified using GNU Fortran's octal notation. (In the GNU Fortran language, the double-quote character (`"') delimits a character constant just as does apostrophe (`''). There is no way to allow both constructs in the general case, since statements like `PRINT *,"2000 !comment?"' would be ambiguous.)  File: g77.info, Node: Exclamation Point, Prev: Double Quote Meaning, Up: VXT Fortran Meaning of Exclamation Point in Column 6 ---------------------------------------- `g77' treats an exclamation point (`!') in column 6 of a fixed-form source file as a continuation character rather than as the beginning of a comment (as it does in any other column) when the `-fvxt' option is specified. The following program, when run, prints a message indicating whether it is interpreted according to GNU Fortran (and Fortran 90) rules or VXT Fortran rules: C234567 (This line begins in column 1.) I = 0 !1 IF (I.EQ.0) PRINT *, ' I am a VXT Fortran program' IF (I.EQ.1) PRINT *, ' I am a Fortran 90 program' IF (I.LT.0 .OR. I.GT.1) PRINT *, ' I am a HAL 9000 computer' END (In the GNU Fortran and Fortran 90 languages, exclamation point is a valid character and, unlike space () or zero (`0'), marks a line as a continuation line when it appears in column 6.)  File: g77.info, Node: Fortran 90, Next: Pedantic Compilation, Prev: VXT Fortran, Up: Other Dialects Fortran 90 ========== The GNU Fortran language includes a number of features that are part of Fortran 90, even when the `-ff90' option is not specified. The features enabled by `-ff90' are intended to be those that, when `-ff90' is not specified, would have another meaning to `g77'--usually meaning something invalid in the GNU Fortran language. So, the purpose of `-ff90' is not to specify whether `g77' is to gratuitously reject Fortran 90 constructs. The `-pedantic' option specified with `-fno-f90' is intended to do that, although its implementation is certainly incomplete at this point. When `-ff90' is specified: * The type of `REAL(EXPR)' and `AIMAG(EXPR)', where EXPR is `COMPLEX' type, is the same type as the real part of EXPR. For example, assuming `Z' is type `COMPLEX(KIND=2)', `REAL(Z)' would return a value of type `REAL(KIND=2)', not of type `REAL(KIND=1)', since `-ff90' is specified.