Go to the first, previous, next, last section, table of contents.

# The GNU Fortran Language

GNU Fortran supports a variety of extensions to, and dialects of, the Fortran language. Its primary base is the ANSI FORTRAN 77 standard, currently available on the network at @url{http://kumo.swcp.com/fortran/F77_std/f77_std.html} or in @url{ftp://ftp.ast.cam.ac.uk/pub/michael/}. It offers some extensions that are popular among users of UNIX `f77` and `f2c` compilers, some that are popular among users of other compilers (such as Digital products), some that are popular among users of the newer Fortran 90 standard, and some that are introduced by GNU Fortran.

Part of what defines a particular implementation of a Fortran system, such as `g77`, is the particular characteristics of how it supports types, constants, and so on. Much of this is left up to the implementation by the various Fortran standards and accepted practice in the industry.

The GNU Fortran language is described below. Much of the material is organized along the same lines as the ANSI FORTRAN 77 standard itself.

See section Other Dialects, for information on features `g77` supports that are not part of the GNU Fortran language.

Note: This portion of the documentation definitely needs a lot of work!

## Direction of Language Development

The purpose of the following description of the GNU Fortran language is to promote wide portability of GNU Fortran programs.

GNU Fortran is an evolving language, due to the fact that `g77` itself is in beta test. Some current features of the language might later be redefined as dialects of Fortran supported by `g77` when better ways to express these features are added to `g77`, for example. Such features would still be supported by `g77`, but would be available only when one or more command-line options were used.

The GNU Fortran language is distinct from the GNU Fortran compilation system (`g77`).

For example, `g77` supports various dialects of Fortran--in a sense, these are languages other than GNU Fortran--though its primary purpose is to support the GNU Fortran language, which also is described in its documentation and by its implementation.

On the other hand, non-GNU compilers might offer support for the GNU Fortran language, and are encouraged to do so.

Currently, the GNU Fortran language is a fairly fuzzy object. It represents something of a cross between what `g77` accepts when compiling using the prevailing defaults and what this document describes as being part of the language.

Future versions of `g77` are expected to clarify the definition of the language in the documentation. Often, this will mean adding new features to the language, in the form of both new documentation and new support in `g77`. However, it might occasionally mean removing a feature from the language itself to "dialect" status. In such a case, the documentation be adjusted to reflect the change, and `g77` itself would likely be changed to require one or more command-line options to continue supporting the feature.

The development of the GNU Fortran language is intended to strike a balance between:

- Serving as a mostly-upwards-compatible language from the de facto UNIX Fortran dialect as supported by `f77`.
- Offering new, well-designed language features. Attributes of such features include not making existing code any harder to read (for those who might be unaware that the new features are not in use) and not making state-of-the-art compilers take longer to issue diagnostics, among others.
- Supporting existing, well-written code without gratuitously rejecting non-standard constructs, regardless of the origin of the code (its dialect).
- Offering default behavior and command-line options to reduce and, where reasonable, eliminate the need for programmers to make any modifications to code that already works in existing production environments.
- Diagnosing constructs that have different meanings in different systems, languages, and dialects, while offering clear, less ambiguous ways to express each of the different meanings so programmers can change their code appropriately.

One of the biggest practical challenges for the developers of the GNU Fortran language is meeting the sometimes contradictory demands of the above items.

For example, a feature might be widely used in one popular environment, but the exact same code that utilizes that feature might not work as expected--perhaps it might mean something entirely different--in another popular environment.

Traditionally, Fortran compilers--even portable ones--have solved this problem by simply offering the appropriate feature to users of the respective systems. This approach treats users of various Fortran systems and dialects as remote "islands", or camps, of programmers, and assume that these camps rarely come into contact with each other (or, especially, with each other's code).

Project GNU takes a radically different approach to software and language design, in that it assumes that users of GNU software do not necessarily care what kind of underlying system they are using, regardless of whether they are using software (at the user-interface level) or writing it (for example, writing Fortran or C code).

As such, GNU users rarely need consider just what kind of underlying hardware (or, in many cases, operating system) they are using at any particular time. They can use and write software designed for a general-purpose, widely portable, heteregenous environment--the GNU environment.

In line with this philosophy, GNU Fortran must evolve into a product that is widely ported and portable not only in the sense that it can be successfully built, installed, and run by users, but in the larger sense that its users can use it in the same way, and expect largely the same behaviors from it, regardless of the kind of system they are using at any particular time.

This approach constrains the solutions `g77` can use to resolve conflicts between various camps of Fortran users. If these two camps disagree about what a particular construct should mean, `g77` cannot simply be changed to treat that particular construct as having one meaning without comment (such as a warning), lest the users expecting it to have the other meaning are unpleasantly surprised that their code misbehaves when executed.

The use of the ASCII backslash character in character constants is an excellent (and still somewhat unresolved) example of this kind of controversy. See section Backslash in Constants. Other examples are likely to arise in the future, as `g77` developers strive to improve its ability to accept an ever-wider variety of existing Fortran code without requiring significant modifications to said code.

Development of GNU Fortran is further constrained by the desire to avoid requiring programmers to change their code. This is important because it allows programmers, administrators, and others to more faithfully evaluate and validate `g77` (as an overall product and as new versions are distributed) without having to support multiple versions of their programs so that they continue to work the same way on their existing systems (non-GNU perhaps, but possibly also earlier versions of `g77`).

## ANSI FORTRAN 77 Standard Support

GNU Fortran supports ANSI FORTRAN 77 with the following caveats. In summary, the only ANSI FORTRAN 77 features `g77` doesn't support are those that are probably rarely used in actual code, some of which are explicitly disallowed by the Fortran 90 standard.

### No Passing External Assumed-length

`g77` disallows passing of an external procedure as an actual argument if the procedure's type is declared `CHARACTER*(*)`. For example:

    CHARACTER*(*) CFUNC
    EXTERNAL CFUNC
    CALL FOO(CFUNC)
    END

It isn't clear whether the standard considers this conforming.

### No Passing Dummy Assumed-length

`g77` disallows passing of a dummy procedure as an actual argument if the procedure's type is declared `CHARACTER*(*)`.

    SUBROUTINE BAR(CFUNC)
    CHARACTER*(*) CFUNC
    EXTERNAL CFUNC
    CALL FOO(CFUNC)
    END

It isn't clear whether the standard considers this conforming.

### No Pathological Implied-DO

The `DO` variable for an implied-`DO` construct in a `DATA` statement may not be used as the `DO` variable for an outer implied-`DO` construct. For example, this fragment is disallowed by `g77`:

    DATA ((A(I, I), I= 1, 10), I= 1, 10) /.../

This also is disallowed by Fortran 90, as it offers no additional capabilities and would have a variety of possible meanings.

Note that it is very unlikely that any production Fortran code tries to use this unsupported construct.

### No Useless Implied-DO

An array element initializer in an implied-`DO` construct in a `DATA` statement must contain at least one reference to the `DO` variables of each outer implied-`DO` construct. For example, this fragment is disallowed by `g77`:

    DATA (A, I= 1, 1) /1./

This also is disallowed by Fortran 90, as FORTRAN 77's more permissive requirements offer no additional capabilities. However, `g77` doesn't necessarily diagnose all cases where this requirement is not met.

Note that it is very unlikely that any production Fortran code tries to use this unsupported construct.

## Conformance

(The following information augments or overrides the information in Section 1.4 of ANSI X3.9-1978 FORTRAN 77 in specifying the GNU Fortran language. Chapter 1 of that document otherwise serves as the basis for the relevant aspects of GNU Fortran.)

The definition of the GNU Fortran language is akin to that of the ANSI FORTRAN 77 language in that it does not generally require conforming implementations to diagnose cases where programs do not conform to the language.

However, `g77` as a compiler is being developed in a way that is intended to enable it to diagnose such cases in an easy-to-understand manner.

A program that conforms to the GNU Fortran language should, when compiled, linked, and executed using a properly installed `g77` system, perform as described by the GNU Fortran language definition. Reasons for different behavior include, among others:

- Use of resources (memory--heap, stack, and so on; disk space; CPU time; etc.) exceeds those of the system.
- Range and/or precision of calculations required by the program exceeds that of the system.
- Excessive reliance on behaviors that are system-dependent (non-portable Fortran code).
- Bugs in the program.
- Bug in `g77`.
- Bugs in the system.

Despite these "loopholes", the availability of a clear specification of the language of programs submitted to `g77`, as this document is intended to provide, is considered an important aspect of providing a robust, clean, predictable Fortran implementation.

The definition of the GNU Fortran language, while having no special legal status, can therefore be viewed as a sort of contract, or agreement. This agreement says, in essence, "if you write a program in this language, and run it in an environment (such as a `g77` system) that supports this language, the program should behave in a largely predictable way".

## Notation Used in This Chapter

(The following information augments or overrides the information in Section 1.5 of ANSI X3.9-1978 FORTRAN 77 in specifying the GNU Fortran language. Chapter 1 of that document otherwise serves as the basis for the relevant aspects of GNU Fortran.)

In this chapter, "must" denotes a requirement, "may" denotes permission, and "must not" and "may not" denote prohibition. Terms such as "might", "should", and "can" generally add little or nothing in the way of weight to the GNU Fortran language itself, but are used to explain or illustrate the language.

For example:

    "The FROBNITZ statement must precede all executable
    statements in a program unit, and may not specify any dummy
    arguments.  It may specify local or common variables and arrays.
    Its use should be limited to portions of the program designed to
    be non-portable and system-specific, because it might cause the
    containing program unit to behave quite differently on different
    systems."

Insofar as the GNU Fortran language is specified, the requirements and permissions denoted by the above sample statement are limited to the placement of the statement and the kinds of things it may specify. The rest of the statement--the content regarding non-portable portions of the program and the differing behavior of program units containing the `FROBNITZ` statement--does not pertain the GNU Fortran language itself. That content offers advice and warnings about the `FROBNITZ` statement.

Remember: The GNU Fortran language definition specifies both what constitutes a valid GNU Fortran program and how, given such a program, a valid GNU Fortran implementation is to interpret that program.

It is not incumbent upon a valid GNU Fortran implementation to behave in any particular way, any consistent way, or any predictable way when it is asked to interpret input that is not a valid GNU Fortran program.

Such input is said to have undefined behavior when interpreted by a valid GNU Fortran implementation, though an implementation may choose to specify behaviors for some cases of inputs that are not valid GNU Fortran programs.

Other notation used herein is that of the GNU texinfo format, which is used to generate printed hardcopy, on-line hypertext (Info), and on-line HTML versions, all from a single source document. This notation is used as follows:

- Keywords defined by the GNU Fortran language are shown in uppercase, as in: `COMMON`, `INTEGER`, and `BLOCK DATA`. Note that, in practice, many Fortran programs are written in lowercase--uppercase is used in this manual as a means to readily distinguish keywords and sample Fortran-related text from the prose in this document.
- Portions of actual sample program, input, or output text look like this: ``Actual program text'`. Generally, uppercase is used for all Fortran-specific and Fortran-related text, though this does not always include literal text within Fortran code. For example: ``PRINT *, 'My name is Bob''`.
- A metasyntactic variable--that is, a name used in this document to serve as a placeholder for whatever text is used by the user or programmer--appears as shown in the following example: "The `INTEGER ivar` statement specifies that ivar is a variable or array of type `INTEGER`." In the above example, any valid text may be substituted for the metasyntactic variable ivar to make the statement apply to a specific instance, as long as the same text is substituted for both occurrences of ivar.
- Ellipses ("...") are used to indicate further text that is either unimportant or expanded upon further, elsewhere.
- Names of data types are in the style of Fortran 90, in most cases. See section Kind Notation, for information on the relationship between Fortran 90 nomenclature (such as `INTEGER(KIND=1)`) and the more traditional, less portably concise nomenclature (such as `INTEGER*4`).

## Fortran Terms and Concepts

(The following information augments or overrides the information in Chapter 2 of ANSI X3.9-1978 FORTRAN 77 in specifying the GNU Fortran language. Chapter 2 of that document otherwise serves as the basis for the relevant aspects of GNU Fortran.)

### Syntactic Items

(Corresponds to Section 2.2 of ANSI X3.9-1978 FORTRAN 77.)

In GNU Fortran, a symbolic name is at least one character long, and has no arbitrary upper limit on length. However, names of entities requiring external linkage (such as external functions, external subroutines, and `COMMON` areas) might be restricted to some arbitrary length by the system. Such a restriction is no more constrained than that of one through six characters.

Underscores (``_'`) are accepted in symbol names after the first character (which must be a letter).

### Statements, Comments, and Lines

(Corresponds to Section 2.3 of ANSI X3.9-1978 FORTRAN 77.)

Use of an exclamation point (``!'`) to begin a trailing comment (a comment that extends to the end of the same source line) is permitted under the following conditions:

- The exclamation point does not appear in column 6. Otherwise, it is treated as an indicator of a continuation line.
- The exclamation point appears outside a character or hollerith constant. Otherwise, the exclamation point is considered part of the constant.
- The exclamation point appears to the left of any other possible trailing comment. That is, a trailing comment may contain exclamation points in their commentary text.

Use of a semicolon (``;'`) as a statement separator is permitted under the following conditions:

- The semicolon appears outside a character or hollerith constant. Otherwise, the semicolon is considered part of the constant.
- The semicolon appears to the left of a trailing comment. Otherwise, the semicolon is considered part of that comment.
- Neither a logical `IF` statement nor a non-construct `WHERE` statement (a Fortran 90 feature) may be followed (in the same, possibly continued, line) by a semicolon used as a statement separator. This restriction avoids the confusion that can result when reading a line such as:

      IF (VALIDP) CALL FOO; CALL BAR

  Some readers might think the ``CALL BAR'` is executed only if ``VALIDP'` is `.TRUE.`, while others might assume its execution is unconditional. (At present, `g77` does not diagnose code that violates this restriction.)

### Scope of Symbolic Names and Statement Labels

(Corresponds to Section 2.9 of ANSI X3.9-1978 FORTRAN 77.)

Included in the list of entities that have a scope of a program unit are construct names (a Fortran 90 feature). See section Construct Names, for more information.

## Characters, Lines, and Execution Sequence

(The following information augments or overrides the information in Chapter 3 of ANSI X3.9-1978 FORTRAN 77 in specifying the GNU Fortran language. Chapter 3 of that document otherwise serves as the basis for the relevant aspects of GNU Fortran.)

### GNU Fortran Character Set

(Corresponds to Section 3.1 of ANSI X3.9-1978 FORTRAN 77.)

Letters include uppercase letters (the twenty-six characters of the English alphabet) and lowercase letters (their lowercase equivalent). Generally, lowercase letters may be used in place of uppercase letters, though in character and hollerith constants, they are distinct.

Special characters include:

- Semicolon (``;'`)
- Exclamation point (``!'`)
- Double quote (``"'`)
- Backslash (``\'`)
- Question mark (``?'`)
- Hash mark (``#'`)
- Ampersand (``&'`)
- Percent sign (``%'`)
- Underscore (``_'`)
- Open angle (``<'`)
- Close angle (``>'`)
- The FORTRAN 77 special characters (`SPC`, ``='`, ``+'`, ``-'`, ``*'`, ``/'`, ``('`, ``)'`, ``,'`, ``.'`, ``$'`, ``''`, and ``:'`)

Note that this document refers to `SPC` as space, while X3.9-1978 FORTRAN 77 refers to it as blank.

### Lines

(Corresponds to Section 3.2 of ANSI X3.9-1978 FORTRAN 77.)

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.

The GNU Fortran language mandates a view applicable to UNIX-like text files--files that are made up of an arbitrary number of lines, each with an arbitrary number of characters (sometimes called stream-based files).

This view does not apply to types of files that are specified as having a particular number of characters on every single line (sometimes referred to as record-based files).

Because a "line in a program unit is a sequence of 72 characters", to quote X3.9-1978, the GNU Fortran language specifies that a stream-based text file is translated to GNU Fortran lines as follows:

- A newline in the file is the character that represents the end of a line of text to the underlying system. For example, on ASCII-based systems, a newline is the `NL` character, which has ASCII value 12 (decimal).
- Each newline in the file serves to end the line of text that precedes it (and that does not contain a newline).
- The end-of-file marker (`EOF`) also serves to end the line of text that precedes it (and that does not contain a newline).
- Any line of text that is shorter than 72 characters is padded to that length with spaces (called "blanks" in the standard).
- Any line of text that is longer than 72 characters is truncated to that length, but the truncated remainder must consist entirely of spaces.
- Characters other than newline and the GNU Fortran character set are invalid.

For the purposes of the remainder of this description of the GNU Fortran language, the translation described above has already taken place, unless otherwise specified.

The result of the above translation is that the source file appears, in terms of the remainder of this description of the GNU Fortran language, as if it had an arbitrary number of 72-character lines, each character being among the GNU Fortran character set.

For example, if the source file itself has two newlines in a row, the second newline becomes, after the above translation, a single line containing 72 spaces.

### Continuation Line

(Corresponds to Section 3.2.3 of ANSI X3.9-1978 FORTRAN 77.)

A continuation line is any line that both

- Contains a continuation character, and
- Contains only spaces in columns 1 through 5

A continuation character is any character of the GNU Fortran character set other than space (`SPC`) or zero (``0'`) in column 6, or a digit (``0'` through ``9'`) in column 7 through 72 of a line that has only spaces to the left of that digit.

The continuation character is ignored as far as the content of the statement is concerned.

The GNU Fortran language places no limit on the number of continuation lines in a statement. In practice, the limit depends on a variety of factors, such as available memory, statement content, and so on, but no GNU Fortran system may impose an arbitrary limit.

### Statements

(Corresponds to Section 3.3 of ANSI X3.9-1978 FORTRAN 77.)

Statements may be written using an arbitrary number of continuation lines.

Statements may be separated using the semicolon (``;'`), except that the logical `IF` and non-construct `WHERE` statements may not be separated from subsequent statements using only a semicolon as statement separator.

The `END PROGRAM`, `END SUBROUTINE`, `END FUNCTION`, and `END BLOCK DATA` statements are alternatives to the `END` statement. These alternatives may be written as normal statements--they are not subject to the restrictions of the `END` statement.

However, no statement other than `END` may have an initial line that appears to be an `END` statement--even `END PROGRAM`, for example, must not be written as:

          END
         &PROGRAM

### Statement Labels

(Corresponds to Section 3.4 of ANSI X3.9-1978 FORTRAN 77.)

A statement separated from its predecessor via a semicolon may be labeled as follows:

- The semicolon is followed by the label for the statement, which in turn follows the label.
- The label must be no more than five digits in length.
- The first digit of the label for the statement is not the first non-space character on a line. Otherwise, that character is treated as a continuation character.

A statement may have only one label defined for it.

### Order of Statements and Lines

(Corresponds to Section 3.5 of ANSI X3.9-1978 FORTRAN 77.)

Generally, `DATA` statements may precede executable statements. However, specification statements pertaining to any entities initialized by a `DATA` statement must precede that `DATA` statement. For example, after ``DATA I/1/'`, ``INTEGER I'` is not permitted, but ``INTEGER J'` is permitted.

The last line of a program unit may be an `END` statement, or may be:

- An `END PROGRAM` statement, if the program unit is a main program.
- An `END SUBROUTINE` statement, if the program unit is a subroutine.
- An `END FUNCTION` statement, if the program unit is a function.
- An `END BLOCK DATA` statement, if the program unit is a block data.

### Including Source Text

Additional source text may be included in the processing of the source file via the `INCLUDE` directive:

    INCLUDE filename

The source text to be included is identified by filename, which is a literal GNU Fortran character constant. The meaning and interpretation of filename depends on the implementation, but typically is a filename.

(`g77` treats it as a filename that it searches for in the current directory and/or directories specified via the ``-I'` command-line option.)

The effect of the `INCLUDE` directive is as if the included text directly replaced the directive in the source file prior to interpretation of the program. Included text may itself use `INCLUDE`. The depth of nested `INCLUDE` references depends on the implementation, but typically is a positive integer.

This virtual replacement treats the statements and `INCLUDE` directives in the included text as syntactically distinct from those in the including text.

Therefore, the first non-comment line of the included text must not be a continuation line. The included text must therefore have, after the non-comment lines, either an initial line (statement), an `INCLUDE` directive, or nothing (the end of the included text).

Similarly, the including text may end the `INCLUDE` directive with a semicolon or the end of the line, but it cannot follow an `INCLUDE` directive at the end of its line with a continuation line. Thus, the last statement in an included text may not be continued.

Any statements between two `INCLUDE` directives on the same line are treated as if they appeared in between the respective included texts. For example:

    INCLUDE 'A'; PRINT *, 'B'; INCLUDE 'C'; END PROGRAM

If the text included by ``INCLUDE 'A''` constitutes a ``PRINT *, 'A''` statement and the text included by ``INCLUDE 'C''` constitutes a ``PRINT *, 'C''` statement, then the output of the above sample program would be

    A
    B
    C

(with suitable allowances for how an implementation defines its handling of output).

Included text must not include itself directly or indirectly, regardless of whether the filename used to reference the text is the same.

Note that `INCLUDE` is not a statement. As such, it is neither a non-executable or executable statement. However, if the text it includes constitutes one or more executable statements, then the placement of `INCLUDE` is subject to effectively the same restrictions as those on executable statements.

An `INCLUDE` directive may be continued across multiple lines as if it were a statement. This permits long names to be used for filename.

## Data Types and Constants

(The following information augments or overrides the information in Chapter 4 of ANSI X3.9-1978 FORTRAN 77 in specifying the GNU Fortran language. Chapter 4 of that document otherwise serves as the basis for the relevant aspects of GNU Fortran.)

To more concisely express the appropriate types for entities, this document uses the more concise Fortran 90 nomenclature such as `INTEGER(KIND=1)` instead of the more traditional, but less portably concise, byte-size-based nomenclature such as `INTEGER*4`, wherever reasonable.

When referring to generic types--in contexts where the specific precision and range of a type are not important--this document uses the generic type names `INTEGER`, `LOGICAL`, `REAL`, `COMPLEX`, and `CHARACTER`.

In some cases, the context requires specification of a particular type. This document uses the ``KIND='` notation to accomplish this throughout, sometimes supplying the more traditional notation for clarification, though the traditional notation might not work the same way on all GNU Fortran implementations.

Use of ``KIND='` makes this document more concise because `g77` is able to define values for ``KIND='` that have the same meanings on all systems, due to the way the Fortran 90 standard specifies these values are to be used.

(In particular, that standard permits an implementation to arbitrarily assign nonnegative values. There are four distinct sets of assignments: one to the `CHARACTER` type; one to the `INTEGER` type; one to the `LOGICAL` type; and the fourth to both the `REAL` and `COMPLEX` types. Implementations are free to assign these values in any order, leave gaps in the ordering of assignments, and assign more than one value to a representation.)

This makes ``KIND='` values superior to the values used in non-standard statements such as ``INTEGER*4'`, because the meanings of the values in those statements vary from machine to machine, compiler to compiler, even operating system to operating system.

However, use of ``KIND='` is not generally recommended when writing portable code (unless, for example, the code is going to be compiled only via `g77`, which is a widely ported compiler). GNU Fortran does not yet have adequate language constructs to permit use of ``KIND='` in a fashion that would make the code portable to Fortran 90 implementations; and, this construct is known to not be accepted by many popular FORTRAN 77 implementations, so it cannot be used in code that is to be ported to those.

The distinction here is that this document is able to use specific values for ``KIND='` to concisely document the types of various operations and operands.

A Fortran program should use the FORTRAN 77 designations for the appropriate GNU Fortran types--such as `INTEGER` for `INTEGER(KIND=1)`, `REAL` for `REAL(KIND=1)`, and `DOUBLE COMPLEX` for `COMPLEX(KIND=2)`---and, where no such designations exist, make use of appropriate techniques (preprocessor macros, parameters, and so on) to specify the types in a fashion that may be easily adjusted to suit each particular implementation to which the program is ported. (These types generally won't need to be adjusted for ports of `g77`.)

Further details regarding GNU Fortran data types and constants are provided below.

### Data Types

(Corresponds to Section 4.1 of ANSI X3.9-1978 FORTRAN 77.)

GNU Fortran supports these types:

1. Integer (generic type `INTEGER`)
2. Real (generic type `REAL`)
3. Double precision
4. Complex (generic type `COMPLEX`)
5. Logical (generic type `LOGICAL`)
6. Character (generic type `CHARACTER`)
7. Double Complex

(The types numbered 1 through 6 above are standard FORTRAN 77 types.)

The generic types shown above are referred to in this document using only their generic type names. Such references usually indicate that any specific type (kind) of that generic type is valid.

For example, a context described in this document as accepting the `COMPLEX` type also is likely to accept the `DOUBLE COMPLEX` type.

The GNU Fortran language supports three ways to specify a specific kind of a generic type.

#### Double Notation

The GNU Fortran language supports two uses of the keyword `DOUBLE` to specify a specific kind of type:

- `DOUBLE PRECISION`, equivalent to `REAL(KIND=2)`
- `DOUBLE COMPLEX`, equivalent to `COMPLEX(KIND=2)`

Use one of the above forms where a type name is valid.

While use of this notation is popular, it doesn't scale well in a language or dialect rich in intrinsic types, as is the case for the GNU Fortran language (especially planned future versions of it).

After all, one rarely sees type names such as ``DOUBLE INTEGER'`, ``QUADRUPLE REAL'`, or ``QUARTER INTEGER'`. Instead, `INTEGER*8`, `REAL*16`, and `INTEGER*1` often are substituted for these, respectively, even though they do not always have the same meanings on all systems. (And, the fact that ``DOUBLE REAL'` does not exist as such is an inconsistency.)

Therefore, this document uses "double notation" only on occasion for the benefit of those readers who are accustomed to it.

#### Star Notation

The following notation specifies the storage size for a type:

    generic-type*n

generic-type must be a generic type--one of `INTEGER`, `REAL`, `COMPLEX`, `LOGICAL`, or `CHARACTER`. n must be one or more digits comprising a decimal integer number greater than zero.

Use the above form where a type name is valid.

The ``*n'` notation specifies that the amount of storage occupied by variables and array elements of that type is n times the storage occupied by a `CHARACTER*1` variable.

This notation might indicate a different degree of precision and/or range for such variables and array elements, and the functions that return values of types using this notation. It does not limit the precision or range of values of that type in any particular way--use explicit code to do that.

Further, the GNU Fortran language requires no particular values for n to be supported by an implementation via the ``*n'` notation. `g77` supports `INTEGER*1` (as `INTEGER(KIND=3)`) on all systems, for example, but not all implementations are required to do so, and `g77` is known to not support `REAL*1` on most (or all) systems.

As a result, except for generic-type of `CHARACTER`, uses of this notation should be limited to isolated portions of a program that are intended to handle system-specific tasks and are expected to be non-portable.

(Standard FORTRAN 77 supports the ``*n'` notation for only `CHARACTER`, where it signifies not only the amount of storage occupied, but the number of characters in entities of that type. However, almost all Fortran compilers have supported this notation for generic types, though with a variety of meanings for n.)

Specifications of types using the ``*n'` notation always are interpreted as specifications of the appropriate types described in this document using the ``KIND=n'` notation, described below.

While use of this notation is popular, it doesn't serve well in the context of a widely portable dialect of Fortran, such as the GNU Fortran language.

For example, even on one particular machine, two or more popular Fortran compilers might well disagree on the size of a type declared `INTEGER*2` or `REAL*16`. Certainly there is known to be disagreement over such things among Fortran compilers on different systems.

Further, this notation offers no elegant way to specify sizes that are not even multiples of the "byte size" typically designated by `INTEGER*1`. Use of "absurd" values (such as `INTEGER*1000`) would certainly be possible, but would perhaps be stretching the original intent of this notation beyond the breaking point in terms of widespread readability of documentation and code making use of it.

Therefore, this document uses "star notation" only on occasion for the benefit of those readers who are accustomed to it.

#### Kind Notation

The following notation specifies the kind-type selector of a type:

    generic-type(KIND=n)

Use the above form where a type name is valid.

generic-type must be a generic type--one of `INTEGER`, `REAL`, `COMPLEX`, `LOGICAL`, or `CHARACTER`. n must be an integer initialization expression that is a positive, nonzero value.

Programmers are discouraged from writing these values directly into their code. Future versions of the GNU Fortran language will offer facilities that will make the writing of code portable to `g77` and Fortran 90 implementations simpler.

However, writing code that ports to existing FORTRAN 77 implementations depends on avoiding the ``KIND='` construct.

The ``KIND='` construct is thus useful in the context of GNU Fortran for two reasons:

- It provides a means to specify a type in a fashion that is portable across all GNU Fortran implementations (though not other FORTRAN 77 and Fortran 90 implementations).
- It provides a sort of Rosetta stone for this document to use to concisely describe the types of various operations and operands.

The values of n in the GNU Fortran language are assigned using a scheme that:

- Attempts to maximize the ability of readers of this document to quickly familiarize themselves with assignments for popular types
- Provides a unique value for each specific desired meaning
- Provides a means to automatically assign new values so they have a "natural" relationship to existing values, if appropriate, or, if no such relationship exists, will not interfere with future values assigned on the basis of such relationships
- Avoids using values that are similar to values used in the existing, popular ``*n'` notation, to prevent readers from expecting that these implied correspondences work on all GNU Fortran implementations

The assignment system accomplishes this by assigning to each "fundamental meaning" of a specific type a unique prime number. Combinations of fundamental meanings--for example, a type that is two times the size of some other type--are assigned values of n that are the products of the values for those fundamental meanings.

A prime value of n is never given more than one fundamental meaning, to avoid situations where some code or system cannot reasonably provide those meanings in the form of a single type.

The values of n assigned so far are:

`KIND=0`
  This is valid only as `INTEGER(KIND=0)` and denotes the `INTEGER` type that has the smallest storage size that holds a pointer on the system. A pointer representable by this type is capable of uniquely addressing a `CHARACTER*1` variable, array, array element, or substring. (Typically this is equivalent to `INTEGER*4` or, on 64-bit systems, `INTEGER*8`. In a compatible C implementation, it typically would be the same size and semantics of the C type `void *`.)
`KIND=1`
  This corresponds to the default types for `REAL`, `INTEGER`, `LOGICAL`, `COMPLEX`, and `CHARACTER`, as appropriate. These are the "default" types described in the Fortran 90 standard, though that standard does not assign any particular ``KIND='` value to these types. (Typically, these are `REAL*4`, `INTEGER*4`, `LOGICAL*4`, and `COMPLEX*8`.)
`KIND=2`
  This corresponds to types that occupy twice as much storage as the default types. `REAL(KIND=2)` is `DOUBLE PRECISION` (typically `REAL*8`), `COMPLEX(KIND=2)` is `DOUBLE COMPLEX` (typically `COMPLEX*16`), These are the "double precision" types described in the Fortran 90 standard, though that standard does not assign any particular ``KIND='` value to these types. n of 4 thus corresponds to types that occupy four times as much storage as the default types, n of 8 to types that occupy eight times as much storage, and so on. The `INTEGER(KIND=2)` and `LOGICAL(KIND=2)` types are not necessarily supported by every GNU Fortran implementation.
`KIND=3`
  This corresponds to types that occupy as much storage as the default `CHARACTER` type, which is the same effective type as `CHARACTER(KIND=1)` (making that type effectively the same as `CHARACTER(KIND=3)`). (Typically, these are `INTEGER*1` and `LOGICAL*1`.) n of 6 thus corresponds to types that occupy twice as much storage as the n=3 types, n of 12 to types that occupy four times as much storage, and so on. These are not necessarily supported by every GNU Fortran implementation.
`KIND=5`
  This corresponds to types that occupy half the storage as the default (n=1) types. (Typically, these are `INTEGER*2` and `LOGICAL*2`.) n of 25 thus corresponds to types that occupy one-quarter as much storage as the default types. These are not necessarily supported by every GNU Fortran implementation.

Note that these are proposed correspondences and might change in future versions of `g77`---avoid writing code depending on them while `g77`, and therefore the GNU Fortran language it defines, is in beta testing.

Values not specified in the above list are reserved to future versions of the GNU Fortran language.

Implementation-dependent meanings will be assigned new, unique prime numbers so as to not interfere with other implementation-dependent meanings, and offer the possibility of increasing the portability of code depending on such types by offering support for them in other GNU Fortran implementations.

Other meanings that might be given unique values are:

- Types that make use of only half their storage size for representing precision and range. For example, some compilers offer options that cause `INTEGER` types to occupy the amount of storage that would be needed for `INTEGER(KIND=2)` types, but the range remains that of `INTEGER(KIND=1)`.
- The IEEE single floating-point type.
- Types with a specific bit pattern (endianness), such as the little-endian form of `INTEGER(KIND=1)`. These could permit, conceptually, use of portable code and implementations on data files written by existing systems.

Future prime numbers should be given meanings in as incremental a fashion as possible, to allow for flexibility and expressiveness in combining types.

For example, instead of defining a prime number for little-endian IEEE doubles, one prime number might be assigned the meaning "little-endian", another the meaning "IEEE double", and the value of n for a little-endian IEEE double would thus naturally be the product of those two respective assigned values. (It could even be reasonable to have IEEE values result from the products of prime values denoting exponent and fraction sizes and meanings, hidden bit usage, availability and representations of special values such as subnormals, infinities, and Not-A-Numbers (NaNs), and so on.)

This assignment mechanism, while not inherently required for future versions of the GNU Fortran language, is worth using because it could ease management of the "space" of supported types much easier in the long run.

The above approach suggests a mechanism for specifying inheritance of intrinsic (built-in) types for an entire, widely portable product line. It is certainly reasonable that, unlike programmers of other languages offering inheritance mechanisms that employ verbose names for classes and subclasses, along with graphical browsers to elucidate the relationships, Fortran programmers would employ a mechanism that works by multiplying prime numbers together and finding the prime factors of such products.

Most of the advantages for the above scheme have been explained above. One disadvantage is that it could lead to the defining, by the GNU Fortran language, of some fairly large prime numbers. This could lead to the GNU Fortran language being declared "munitions" by the United States Department of Defense.

### Constants

(Corresponds to Section 4.2 of ANSI X3.9-1978 FORTRAN 77.)

A typeless constant has one of the following forms:

    'binary-digits'B
    'octal-digits'O
    'hexadecimal-digits'Z
    'hexadecimal-digits'X

binary-digits, octal-digits, and hexadecimal-digits are nonempty strings of characters in the set ``01'`, ``01234567'`, and ``0123456789ABCDEFabcdef'`, respectively. (The value for ``A'` (and ``a'`) is 10, for ``B'` and ``b'` is 11, and so on.)

Typeless constants have values that depend on the context in which they are used.

All other constants, called typed constants, are interpreted--converted to internal form--according to their inherent type. Thus, context is never a determining factor for the type, and hence the interpretation, of a typed constant. (All constants in the ANSI FORTRAN 77 language are typed constants.)

For example, ``1'` is always type `INTEGER(KIND=1)` in GNU Fortran (called default INTEGER in Fortran 90), ``9.435784839284958'` is always type `REAL(KIND=1)` (even if the additional precision specified is lost, and even when used in a `REAL(KIND=2)` context), ``1E0'` is always type `REAL(KIND=2)`, and ``1D0'` is always type `REAL(KIND=2)`.

### Integer Type

(Corresponds to Section 4.3 of ANSI X3.9-1978 FORTRAN 77.)

An integer constant also may have one of the following forms:

    B'binary-digits'
    O'octal-digits'
    Z'hexadecimal-digits'
    X'hexadecimal-digits'

binary-digits, octal-digits, and hexadecimal-digits are nonempty strings of characters in the set ``01'`, ``01234567'`, and ``0123456789ABCDEFabcdef'`, respectively. (The value for ``A'` (and ``a'`) is 10, for ``B'` and ``b'` is 11, and so on.)

### Character Type

(Corresponds to Section 4.8 of ANSI X3.9-1978 FORTRAN 77.)

A character constant may be delimited by a pair of double quotes (``"'`) instead of apostrophes. In this case, an apostrophe within the constant represents a single apostrophe, while a double quote is represented in the source text of the constant by two consecutive double quotes with no intervening blanks.

A character constant may be empty (have a length of zero).

A character constant may include a substring specification, The value of such a constant is the value of the substring--for example, the value of ``'hello'(3:5)'` is the same as the value of ``'llo''`.

## Expressions

(The following information augments or overrides the information in Chapter 6 of ANSI X3.9-1978 FORTRAN 77 in specifying the GNU Fortran language. Chapter 6 of that document otherwise serves as the basis for the relevant aspects of GNU Fortran.)

### The `%LOC()` Construct

    %LOC(arg)

The `%LOC()` construct is an expression that yields the value of the location of its argument, arg, in memory. The size of the type of the expression depends on the system--typically, it is equivalent to either `INTEGER(KIND=1)` or `INTEGER(KIND=2)`, though it is actually type `INTEGER(KIND=0)`.

The argument to `%LOC()` must be suitable as the left-hand side of an assignment statement. That is, it may not be a general expression involving operators such as addition, subtraction, and so on, nor may it be a constant.

Use of `%LOC()` is recommended only for code that is accessing facilities outside of GNU Fortran, such as operating system or windowing facilities. It is best to constrain such uses to isolated portions of a program--portions that deal specifically and exclusively with low-level, system-dependent facilities. Such portions might well provide a portable interface for use by the program as a whole, but are themselves not portable, and should be thoroughly tested each time they are rebuilt using a new compiler or version of a compiler.

Do not depend on `%LOC()` returning a pointer that can be safely used to define (change) the argument. While this might work in some circumstances, it is hard to predict whether it will continue to work when a program (that works using this unsafe behavior) is recompiled using different command-line options or a different version of `g77`.

Generally, `%LOC()` is safe when used as an argument to a procedure that makes use of the value of the corresponding dummy argument only during its activation, and only when such use is restricted to referencing (reading) the value of the argument to `%LOC()`.

Implementation Note: Currently, `g77` passes arguments (those not passed using a construct such as `%VAL()`) by reference or descriptor, depending on the type of the actual argument. Thus, given ``INTEGER I'`, ``CALL FOO(I)'` would seem to mean the same thing as ``CALL FOO(%LOC(I))'`, and in fact might compile to identical code.

However, ``CALL FOO(%LOC(I))'` emphatically means "pass the address of ``I'` in memory". While ``CALL FOO(I)'` might use that same approach in a particular version of `g77`, another version or compiler might choose a different implementation, such as copy-in/copy-out, to effect the desired behavior--and which will therefore not necessarily compile to the same code as would ``CALL FOO(%LOC(I))'` using the same version or compiler.

See section Debugging and Interfacing, for detailed information on how this particular version of `g77` implements various constructs.

## Specification Statements

(The following information augments or overrides the information in Chapter 8 of ANSI X3.9-1978 FORTRAN 77 in specifying the GNU Fortran language. Chapter 8 of that document otherwise serves as the basis for the relevant aspects of GNU Fortran.)

### `NAMELIST` Statement

The `NAMELIST` statement, and related I/O constructs, are supported by the GNU Fortran language in essentially the same way as they are by `f2c`.

### `DOUBLE COMPLEX` Statement

`DOUBLE COMPLEX` is a type-statement (and type) that specifies the type `COMPLEX(KIND=2)` in GNU Fortran.

## Control Statements

(The following information augments or overrides the information in Chapter 11 of ANSI X3.9-1978 FORTRAN 77 in specifying the GNU Fortran language. Chapter 11 of that document otherwise serves as the basis for the relevant aspects of GNU Fortran.)

### DO WHILE

The `DO WHILE` statement, a feature of both the MIL-STD 1753 and Fortran 90 standards, is provided by the GNU Fortran language.

### END DO

The `END DO` statement is provided by the GNU Fortran language.

This statement is used in one of two ways:

- The Fortran 90 meaning, in which it specifies the termination point of a single `DO` loop started with a `DO` statement that specifies no termination label.
- The MIL-STD 1753 meaning, in which it specifies the termination point of one or more `DO` loops, all of which start with a `DO` statement that specify the label defined for the `END DO` statement. This kind of `END DO` statement is merely a synonym for `CONTINUE`, except it is permitted only when the statement is labeled and a target of one or more labeled `DO` loops. It is expected that this use of `END DO` will be removed from the GNU Fortran language in the future, though it is likely that it will long be supported by `g77` as a dialect form.

### Construct Names

The GNU Fortran language supports construct names as defined by the Fortran 90 standard. These names are local to the program unit and are defined as follows:

    construct-name: block-statement

Here, construct-name is the construct name itself; its definition is connoted by the single colon (``:'`); and block-statement is an `IF`, `DO`, or `SELECT CASE` statement that begins a block.

A block that is given a construct name must also specify the same construct name in its termination statement:

    END block construct-name

Here, block must be `IF`, `DO`, or `SELECT`, as appropriate.

### The `CYCLE` and `EXIT` Statements

The `CYCLE` and `EXIT` statements specify that the remaining statements in the current iteration of a particular active (enclosing) `DO` loop are to be skipped.

`CYCLE` specifies that these statements are skipped, but the `END DO` statement that marks the end of the `DO` loop be executed--that is, the next iteration, if any, is to be started. If the statement marking the end of the `DO` loop is not `END DO`---in other words, if the loop is not a block `DO`---the `CYCLE` statement does not execute that statement, but does start the next iteration (if any).

`EXIT` specifies that the loop specified by the `DO` construct is terminated.

The `DO` loop affected by `CYCLE` and `EXIT` is the innermost enclosing `DO` loop when the following forms are used:

    CYCLE
    EXIT

Otherwise, the following forms specify the construct name of the pertinent `DO` loop:

    CYCLE construct-name
    EXIT construct-name

`CYCLE` and `EXIT` can be viewed as glorified `GO TO` statements. However, they cannot be easily thought of as `GO TO` statements in obscure cases involving FORTRAN 77 loops. For example:

          DO 10 I = 1, 5
          DO 10 J = 1, 5
             IF (J .EQ. 5) EXIT
          DO 10 K = 1, 5
             IF (K .EQ. 3) CYCLE
    10    PRINT *, 'I=', I, ' J=', J, ' K=', K
    20    CONTINUE

In particular, neither the `EXIT` nor `CYCLE` statements above are equivalent to a `GO TO` statement to either label ``10'` or ``20'`.

To understand the effect of `CYCLE` and `EXIT` in the above fragment, it is helpful to first translate it to its equivalent using only block `DO` loops:

          DO I = 1, 5
             DO J = 1, 5
                IF (J .EQ. 5) EXIT
                DO K = 1, 5
                   IF (K .EQ. 3) CYCLE
    10             PRINT *, 'I=', I, ' J=', J, ' K=', K
                END DO
             END DO
          END DO
    20    CONTINUE

Adding new labels allows translation of `CYCLE` and `EXIT` to `GO TO` so they may be more easily understood by programmers accustomed to FORTRAN coding:

          DO I = 1, 5
             DO J = 1, 5
                IF (J .EQ. 5) GOTO 18
                DO K = 1, 5
                   IF (K .EQ. 3) GO TO 12
    10             PRINT *, 'I=', I, ' J=', J, ' K=', K
    12          END DO
             END DO
    18    END DO
    20    CONTINUE

Thus, the `CYCLE` statement in the innermost loop skips over the `PRINT` statement as it begins the next iteration of the loop, while the `EXIT` statement in the middle loop ends that loop but not the outermost loop.

## Functions and Subroutines

(The following information augments or overrides the information in Chapter 15 of ANSI X3.9-1978 FORTRAN 77 in specifying the GNU Fortran language. Chapter 15 of that document otherwise serves as the basis for the relevant aspects of GNU Fortran.)

### The `%VAL()` Construct

    %VAL(arg)

The `%VAL()` construct specifies that an argument, arg, is to be passed by value, instead of by reference or descriptor.

`%VAL()` is restricted to actual arguments in invocations of external procedures.

Use of `%VAL()` is recommended only for code that is accessing facilities outside of GNU Fortran, such as operating system or windowing facilities. It is best to constrain such uses to isolated portions of a program--portions the deal specifically and exclusively with low-level, system-dependent facilities. Such portions might well provide a portable interface for use by the program as a whole, but are themselves not portable, and should be thoroughly tested each time they are rebuilt using a new compiler or version of a compiler.

Implementation Note: Currently, `g77` passes all arguments either by reference or by descriptor.

Thus, use of `%VAL()` tends to be restricted to cases where the called procedure is written in a language other than Fortran that supports call-by-value semantics. (C is an example of such a language.)

See section Procedures (SUBROUTINE and FUNCTION), for detailed information on how this particular version of `g77` passes arguments to procedures.

### The `%REF()` Construct

    %REF(arg)

The `%REF()` construct specifies that an argument, arg, is to be passed by reference, instead of by value or descriptor.

`%REF()` is restricted to actual arguments in invocations of external procedures.

Use of `%REF()` is recommended only for code that is accessing facilities outside of GNU Fortran, such as operating system or windowing facilities. It is best to constrain such uses to isolated portions of a program--portions the deal specifically and exclusively with low-level, system-dependent facilities. Such portions might well provide a portable interface for use by the program as a whole, but are themselves not portable, and should be thoroughly tested each time they are rebuilt using a new compiler or version of a compiler.

Do not depend on `%REF()` supplying a pointer to the procedure being invoked. While that is a likely implementation choice, other implementation choices are available that preserve Fortran pass-by-reference semantics without passing a pointer to the argument, arg. (For example, a copy-in/copy-out implementation.)

Implementation Note: Currently, `g77` passes all arguments (other than variables and arrays of type `CHARACTER`) by reference. Future versions of, or dialects supported by, `g77` might not pass `CHARACTER` functions by reference.

Thus, use of `%REF()` tends to be restricted to cases where arg is type `CHARACTER` but the called procedure accesses it via a means other than the method used for Fortran `CHARACTER` arguments.

See section Procedures (SUBROUTINE and FUNCTION), for detailed information on how this particular version of `g77` passes arguments to procedures.

### The `%DESCR()` Construct

    %DESCR(arg)

The `%DESCR()` construct specifies that an argument, arg, is to be passed by descriptor, instead of by value or reference.

`%DESCR()` is restricted to actual arguments in invocations of external procedures.

Use of `%DESCR()` is recommended only for code that is accessing facilities outside of GNU Fortran, such as operating system or windowing facilities. It is best to constrain such uses to isolated portions of a program--portions the deal specifically and exclusively with low-level, system-dependent facilities. Such portions might well provide a portable interface for use by the program as a whole, but are themselves not portable, and should be thoroughly tested each time they are rebuilt using a new compiler or version of a compiler.

Do not depend on `%DESCR()` supplying a pointer and/or a length passed by value to the procedure being invoked. While that is a likely implementation choice, other implementation choices are available that preserve the pass-by-reference semantics without passing a pointer to the argument, arg. (For example, a copy-in/copy-out implementation.) And, future versions of `g77` might change the way descriptors are implemented, such as passing a single argument pointing to a record containing the pointer/length information instead of passing that same information via two arguments as it currently does.

Implementation Note: Currently, `g77` passes all variables and arrays of type `CHARACTER` by descriptor. Future versions of, or dialects supported by, `g77` might pass `CHARACTER` functions by descriptor as well.

Thus, use of `%DESCR()` tends to be restricted to cases where arg is not type `CHARACTER` but the called procedure accesses it via a means similar to the method used for Fortran `CHARACTER` arguments.

See section Procedures (SUBROUTINE and FUNCTION), for detailed information on how this particular version of `g77` passes arguments to procedures.

### Generics and Specifics

The ANSI FORTRAN 77 language defines generic and specific intrinsics. In short, the distinctions are:

- Specific intrinsics have specific types for their arguments and a specific return type.
- Generic intrinsics are treated, on a case-by-case basis in the program's source code, as one of several possible specific intrinsics. Typically, a generic intrinsic has a return type that is determined by the type of one or more of its arguments.

The GNU Fortran language generalizes these concepts somewhat, especially by providing intrinsic subroutines and generic intrinsics that are treated as either a specific intrinsic subroutine or a specific intrinsic function (e.g. `SECOND`).

However, GNU Fortran avoids generalizing this concept to the point where existing code would be accepted as meaning something possibly different than what was intended.

For example, `ABS` is a generic intrinsic, so all working code written using `ABS` of an `INTEGER` argument expects an `INTEGER` return value. Similarly, all such code expects that `ABS` of an `INTEGER*2` argument returns an `INTEGER*2` return value.

Yet, `IABS` is a specific intrinsic that accepts only an `INTEGER(KIND=1)` argument. Code that passes something other than an `INTEGER(KIND=1)` argument to `IABS` is not valid GNU Fortran code, because it is not clear what the author intended.

For example, if ``J'` is `INTEGER(KIND=6)`, ``IABS(J)'` is not defined by the GNU Fortran language, because the programmer might have used that construct to mean any of the following, subtly different, things:

- Convert ``J'` to `INTEGER(KIND=1)` first (as if ``IABS(INT(J))'` had been written).
- Convert the result of the intrinsic to `INTEGER(KIND=1)` (as if ``INT(ABS(J))'` had been written).
- No conversion (as if ``ABS(J)'` had been written).

The distinctions matter especially when types and values wider than `INTEGER(KIND=1)` (such as `INTEGER(KIND=2)`), or when operations performing more "arithmetic" than absolute-value, are involved.

The following sample program is not a valid GNU Fortran program, but might be accepted by other compilers. If so, the output is likely to be revealing in terms of how a given compiler treats intrinsics (that normally are specific) when they are given arguments that do not conform to their stated requirements:

          PROGRAM JCB002
    C
    C Written by James Craig Burley 1997-02-20.
    C Contact via Internet email: burley@gnu.ai.mit.edu
    C
    C Determine how compilers handle non-standard IDIM
    C on INTEGER*2 operands, which presumably can be
    C extrapolated into understanding how the compiler
    C generally treats specific intrinsics that are passed
    C arguments not of the correct types.
    C
    C If your compiler implements INTEGER*2 and INTEGER
    C as the same type, change all INTEGER*2 below to
    C INTEGER*1.
    C
          INTEGER*2 I0, I4
          INTEGER I1, I2, I3
          INTEGER*2 ISMALL, ILARGE
          INTEGER*2 ITOOLG, ITWO
          LOGICAL L2, L3, L4
    C
    C Find smallest INTEGER*2 number.
    C
          ISMALL=0
     10   I0 = ISMALL-1
          IF ((I0 .GE. ISMALL) .OR. (I0+1 .NE. ISMALL)) GOTO 20
          ISMALL = I0
          GOTO 10
     20   CONTINUE
    C
    C Find largest INTEGER*2 number.
    C
          ILARGE=0
     30   I0 = ILARGE+1
          IF ((I0 .LE. ILARGE) .OR. (I0-1 .NE. ILARGE)) GOTO 40
          ILARGE = I0
          GOTO 30
     40   CONTINUE
    C
    C Multiplying by two adds stress to the situation.
    C
          ITWO = 2
    C
    C Need a number that, added to -2, is too wide to fit in I*2.
    C
          ITOOLG = ISMALL
    C
    C Use IDIM the straightforward way.
    C
          I1 = IDIM (ILARGE, ISMALL) * ITWO + ITOOLG
    C
    C Try first interpretation.
    C
          I2 = (INT (ILARGE) - INT (ISMALL)) * ITWO + ITOOLG
    C
    C Try second interpretation.
    C
          I3 = (INT (ILARGE - ISMALL)) * ITWO + ITOOLG
    C
    C Try third interpretation.
    C
          I4 = (ILARGE - ISMALL) * ITWO + ITOOLG
    C
    C Print results.
    C
          PRINT *, 'ILARGE=', ILARGE
          PRINT *, 'ITWO=', ITWO
          PRINT *, 'ITOOLG=', ITOOLG
          PRINT *, 'ISMALL=', ISMALL
          PRINT *, 'I1=', I1
          PRINT *, 'I2=', I2
          PRINT *, 'I3=', I3
          PRINT *, 'I4=', I4
          PRINT *
          L2 = (I1 .EQ. I2)
          L3 = (I1 .EQ. I3)
          L4 = (I1 .EQ. I4)
          IF (L2 .AND. .NOT.L3 .AND. .NOT.L4) THEN
             PRINT *, 'Interp 1: IDIM(I*2,I*2) => IDIM(INT(I*2),INT(I*2))'
             STOP
          END IF
          IF (L3 .AND. .NOT.L2 .AND. .NOT.L4) THEN
             PRINT *, 'Interp 2: IDIM(I*2,I*2) => INT(DIM(I*2,I*2))'
             STOP
          END IF
          IF (L4 .AND. .NOT.L2 .AND. .NOT.L3) THEN
             PRINT *, 'Interp 3: IDIM(I*2,I*2) => DIM(I*2,I*2)'
             STOP
          END IF
          PRINT *, 'Results need careful analysis.'
          END

It is possible that a future version of the GNU Fortran language will permit specific intrinsic invocations with wrong-typed arguments (such as `IDIM` in the above example) if the vast majority of production compilers agree on the interpretation of such invocations.

Especially if you know of a compiler that does not implement interpretation 3 above (output ``Interp 3: ...'`), please let us know the details (compiler product, version, machine, results, and so on).

### `REAL()` and `AIMAG()` of Complex

The GNU Fortran language disallows `REAL(expr)` and `AIMAG(expr)`, where expr is any `COMPLEX` type other than `COMPLEX(KIND=1)`, except when they are used in the following way:

    REAL(REAL(expr))
    REAL(AIMAG(expr))

The above forms explicitly specify that the desired effect is to convert the real or imaginary part of expr, which might be some `REAL` type other than `REAL(KIND=1)`, to type `REAL(KIND=1)`, and have that serve as the value of the expression.

The GNU Fortran language offers clearly named intrinsics to extract the real and imaginary parts of a complex entity without any conversion:

    REALPART(expr)
    IMAGPART(expr)

To express the above using typical extended FORTRAN 77, use the following constructs (when expr is `COMPLEX(KIND=2)`):

    DBLE(expr)
    DIMAG(expr)

The FORTRAN 77 language offers no way to explicitly specify the real and imaginary parts of a complex expression of arbitrary type, apparently as a result of requiring support for only one `COMPLEX` type (`COMPLEX(KIND=1)`). The concepts of converting an expression to type `REAL(KIND=1)` and of extracting the real part of a complex expression were thus "smooshed" by FORTRAN 77 into a single intrinsic, since they happened to have the exact same effect in that language (due to having only one `COMPLEX` type).

Note: When ``-ff90'` is in effect, `g77` treats ``REAL(expr)'`, where expr is of type `COMPLEX`, as ``REALPART(expr)'`, whereas with ``-fugly-complex -fno-f90'` in effect, it is treated as ``REAL(REALPART(expr))'`.

See section Ugly Complex Part Extraction, for more information.

### `CMPLX()` of `DOUBLE PRECISION`

In accordance with Fortran 90 and at least some (perhaps all) other compilers, the GNU Fortran language defines `CMPLX()` as always returning a result that is type `COMPLEX(KIND=1)`.

This means ``CMPLX(D1,D2)'`, where ``D1'` and ``D2'` are `REAL(KIND=2)` (`DOUBLE PRECISION`), is treated as:

    CMPLX(SNGL(D1), SNGL(D2))

The GNU Fortran language also provides the `DCMPLX()` intrinsic, which is provided by some FORTRAN 77 compilers to construct a `DOUBLE COMPLEX` entity from of `DOUBLE PRECISION` operands. However, this solution does not scale well when more `COMPLEX` types (having various precisions and ranges) are offered by Fortran implementations.

Fortran 90 extends the `CMPLX()` intrinsic by adding an extra argument used to specify the desired kind of complex result. However, this solution is somewhat awkward to use.

The GNU Fortran language provides a simple way to build a complex value out of two numbers, with the precise type of the value determined by the types of the two numbers (via the usual type-promotion mechanism):

    COMPLEX(real, imag)

When real and imag are the same `REAL` types, `COMPLEX()` performs no conversion other than to put them together to form a complex result of the same (complex version of real) type.

See section Complex Intrinsic, for more information.

### MIL-STD 1753 Support

The GNU Fortran language includes the MIL-STD 1753 intrinsics `BTEST`, `IAND`, `IBCLR`, `IBITS`, `IBSET`, `IEOR`, `IOR`, `ISHFT`, `ISHFTC`, `MVBITS`, and `NOT`.

### `f77`/`f2c` Intrinsics

The bit-manipulation intrinsics supported by traditional `f77` and by `f2c` are available in the GNU Fortran language. These include `AND`, `LSHIFT`, `OR`, `RSHIFT`, and `XOR`.

Also supported are the intrinsics `CDABS`, `CDCOS`, `CDEXP`, `CDLOG`, `CDSIN`, `CDSQRT`, `DCMPLX`, `DCONJG`, `DFLOAT`, `DIMAG`, `DREAL`, and `IMAG`, `ZABS`, `ZCOS`, `ZEXP`, `ZLOG`, `ZSIN`, and `ZSQRT`.

### Table of Intrinsic Functions

(Corresponds to Section 15.10 of ANSI X3.9-1978 FORTRAN 77.)

The GNU Fortran language adds various functions, subroutines, types, and arguments to the set of intrinsic functions in ANSI FORTRAN 77. The complete set of intrinsics supported by the GNU Fortran language is described below.

Note that a name is not treated as that of an intrinsic if it is specified in an `EXTERNAL` statement in the same program unit; if a command-line option is used to disable the groups to which the intrinsic belongs; or if the intrinsic is not named in an `INTRINSIC` statement and a command-line option is used to hide the groups to which the intrinsic belongs.

So, it is recommended that any reference in a program unit to an intrinsic procedure that is not a standard FORTRAN 77 intrinsic be accompanied by an appropriate `INTRINSIC` statement in that program unit. This sort of defensive programming makes it more likely that an implementation will issue a diagnostic rather than generate incorrect code for such a reference.

The terminology used below is based on that of the Fortran 90 standard, so that the text may be more concise and accurate:

- `OPTIONAL` means the argument may be omitted.
- ``A-1, A-2, ..., A-n'` means more than one argument (generally named ``A'`) may be specified.
- ``scalar'` means the argument must not be an array (must be a variable or array element, or perhaps a constant if expressions are permitted).
- ``DIMENSION(4)'` means the argument must be an array having 4 elements.
- `INTENT(IN)` means the argument must be an expression (such as a constant or a variable that is defined upon invocation of the intrinsic).
- `INTENT(OUT)` means the argument must be definable by the invocation of the intrinsic (that is, must not be a constant nor an expression involving operators other than array reference and substring reference).
- `INTENT(INOUT)` means the argument must be defined prior to, and definable by, invocation of the intrinsic (a combination of the requirements of `INTENT(IN)` and `INTENT(OUT)`.

#### Abort Intrinsic

    CALL Abort()

Intrinsic groups: `unix`.

Description:

Prints a message and potentially causes a core dump via `abort(3)`.

#### Abs Intrinsic

    Abs(A)

Abs: `INTEGER` or `REAL` function. The exact type depends on that of argument A---if A is `COMPLEX`, this function's type is `REAL` with the same ``KIND='` value as the type of A. Otherwise, this function's type is the same as that of A.

A: `INTEGER`, `REAL`, or `COMPLEX`; scalar; INTENT(IN).

Intrinsic groups: (standard FORTRAN 77).

Description:

Returns the absolute value of A.

If A is type `COMPLEX`, the absolute value is computed as:

    SQRT(REALPART(A)**2, IMAGPART(A)**2)

Otherwise, it is computed by negating the A if it is negative, or returning A.

See section Sign Intrinsic, for how to explicitly compute the positive or negative form of the absolute value of an expression.

#### Access Intrinsic

    Access(Name, Mode)

Access: `INTEGER(KIND=1)` function.

Name: `CHARACTER`; scalar; INTENT(IN).

Mode: `CHARACTER`; scalar; INTENT(IN).

Intrinsic groups: `unix`.

Description:

Checks file Name for accessibility in the mode specified by Mode and returns 0 if the file is accessible in that mode, otherwise an error code if the file is inaccessible or Mode is invalid. See `access(2)`. Mode may be a concatenation of any of the following characters:

``r'`
  Read permission
``w'`
  Write permission
``x'`
  Execute permission
```SPC`'`
  Existence

#### AChar Intrinsic

    AChar(I)

AChar: `CHARACTER*1` function.

I: `INTEGER`; scalar; INTENT(IN).

Intrinsic groups: `f2c`, `f90`.

Description:

Returns the ASCII character corresponding to the code specified by I.

See section IAChar Intrinsic, for the inverse function.

See section Char Intrinsic, for the function corresponding to the system's native character set.

#### ACos Intrinsic

    ACos(X)

ACos: `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 arc-cosine (inverse cosine) of X in radians.

See section Cos Intrinsic, for the inverse function.

#### AImag Intrinsic

    AImag(Z)

AImag: `REAL` function. This intrinsic is valid when argument Z is `COMPLEX(KIND=1)`. When Z is any other `COMPLEX` type, this intrinsic is valid only when used as the argument to `REAL()`, as explained below.

Z: `COMPLEX`; scalar; INTENT(IN).

Intrinsic groups: (standard FORTRAN 77).

Description:

Returns the (possibly converted) imaginary part of Z.

Use of `AIMAG()` with an argument of a type other than `COMPLEX(KIND=1)` is restricted to the following case:

    REAL(AIMAG(Z))

This expression converts the imaginary part of Z to `REAL(KIND=1)`.

See section `REAL()` and `AIMAG()` of Complex, for more information.

#### AInt Intrinsic

    AInt(A)

AInt: `REAL` function, the ``KIND='` value of the type being that of argument A.

A: `REAL`; scalar; INTENT(IN).

Intrinsic groups: (standard FORTRAN 77).

Description:

Returns A with the fractional portion of its magnitude truncated and its sign preserved. (Also called "truncation towards zero".)

See section ANInt Intrinsic, for how to round to nearest whole number.

See section Int Intrinsic, for how to truncate and then convert number to `INTEGER`.

#### ALog Intrinsic

    ALog(X)

ALog: `REAL(KIND=1)` function.

X: `REAL(KIND=1)`; scalar; INTENT(IN).

Intrinsic groups: (standard FORTRAN 77).

Description:

Archaic form of `LOG()` that is specific to one type for X. See section Log Intrinsic.

#### ALog10 Intrinsic

    ALog10(X)

ALog10: `REAL(KIND=1)` function.

X: `REAL(KIND=1)`; scalar; INTENT(IN).

Intrinsic groups: (standard FORTRAN 77).

Description:

Archaic form of `LOG10()` that is specific to one type for X. See section Log10 Intrinsic.

#### AMax0 Intrinsic

    AMax0(A-1, A-2, ..., A-n)

AMax0: `REAL(KIND=1)` function.

A: `INTEGER(KIND=1)`; at least two such arguments must be provided; scalar; INTENT(IN).

Intrinsic groups: (standard FORTRAN 77).

Description:

Archaic form of `MAX()` that is specific to one type for A and a different return type. See section Max Intrinsic.

#### AMax1 Intrinsic

    AMax1(A-1, A-2, ..., A-n)

AMax1: `REAL(KIND=1)` function.

A: `REAL(KIND=1)`; at least two such arguments must be provided; scalar; INTENT(IN).

Intrinsic groups: (standard FORTRAN 77).

Description:

Archaic form of `MAX()` that is specific to one type for A. See section Max Intrinsic.

#### AMin0 Intrinsic

    AMin0(A-1, A-2, ..., A-n)

AMin0: `REAL(KIND=1)` function.

A: `INTEGER(KIND=1)`; at least two such arguments must be provided; scalar; INTENT(IN).

Intrinsic groups: (standard FORTRAN 77).

Description:

Archaic form of `MIN()` that is specific to one type for A and a different return type. See section Min Intrinsic.

#### AMin1 Intrinsic

    AMin1(A-1, A-2, ..., A-n)

AMin1: `REAL(KIND=1)` function.

A: `REAL(KIND=1)`; at least two such arguments must be provided; scalar; INTENT(IN).

Intrinsic groups: (standard FORTRAN 77).

Description:

Archaic form of `MIN()` that is specific to one type for A. See section Min Intrinsic.

#### AMod Intrinsic

    AMod(A, P)

AMod: `REAL(KIND=1)` function.

A: `REAL(KIND=1)`; scalar; INTENT(IN).

P: `REAL(KIND=1)`; scalar; INTENT(IN).

Intrinsic groups: (standard FORTRAN 77).

Description:

Archaic form of `MOD()` that is specific to one type for A. See section Mod Intrinsic.

#### And Intrinsic

    And(I, J)

And: `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 AND of pair of bits in each of I and J.

#### ANInt Intrinsic

    ANInt(A)

ANInt: `REAL` function, the ``KIND='` value of the type being that of argument A.

A: `REAL`; scalar; INTENT(IN).

Intrinsic groups: (standard FORTRAN 77).

Description:

Returns A with the fractional portion of its magnitude eliminated by rounding to the nearest whole number and with its sign preserved.

A fractional portion exactly equal to ``.5'` is rounded to the whole number that is larger in magnitude. (Also called "Fortran round".)

See section AInt Intrinsic, for how to truncate to whole number.

See section NInt Intrinsic, for how to round and then convert number to `INTEGER`.

#### ASin Intrinsic

    ASin(X)

ASin: `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 arc-sine (inverse sine) of X in radians.

See section Sin Intrinsic, for the inverse function.

#### ATan Intrinsic

    ATan(X)

ATan: `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 arc-tangent (inverse tangent) of X in radians.

See section Tan Intrinsic, for the inverse function.

#### ATan2 Intrinsic

    ATan2(Y, X)

ATan2: `REAL` function, the exact type being the result of cross-promoting the types of all the arguments.

Y: `REAL`; scalar; INTENT(IN).

X: `REAL`; scalar; INTENT(IN).

Intrinsic groups: (standard FORTRAN 77).

Description:

Returns the arc-tangent (inverse tangent) of the complex number (Y, X) in radians.

See section Tan Intrinsic, for the inverse function.

#### BesJ0 Intrinsic

    BesJ0(X)

BesJ0: `REAL` function, the ``KIND='` value of the type being that of argument X.

X: `REAL`; scalar; INTENT(IN).

Intrinsic groups: `unix`.

Description:

Calculates the Bessel function of the first kind of order 0. See `bessel(3m)`, on whose implementation the function depends.

#### BesJ1 Intrinsic

    BesJ1(X)

BesJ1: `REAL` function, the ``KIND='` value of the type being that of argument X.

X: `REAL`; scalar; INTENT(IN).

Intrinsic groups: `unix`.

Description:

Calculates the Bessel function of the first kind of order 1. See `bessel(3m)`, on whose implementation the function depends.

#### BesJN Intrinsic

    BesJN(N, X)

BesJN: `REAL` function, the ``KIND='` value of the type being that of argument X.

N: `INTEGER`; scalar; INTENT(IN).

X: `REAL`; scalar; INTENT(IN).

Intrinsic groups: `unix`.

Description:

Calculates the Bessel function of the first kind of order N. See `bessel(3m)`, on whose implementation the function depends.

#### BesY0 Intrinsic

    BesY0(X)

BesY0: `REAL` function, the ``KIND='` value of the type being that of argument X.

X: `REAL`; scalar; INTENT(IN).

Intrinsic groups: `unix`.

Description:

Calculates the Bessel function of the second kind of order 0. See `bessel(3m)`, on whose implementation the function depends.

#### BesY1 Intrinsic

    BesY1(X)

BesY1: `REAL` function, the ``KIND='` value of the type being that of argument X.

X: `REAL`; scalar; INTENT(IN).

Intrinsic groups: `unix`.

Description:

Calculates the Bessel function of the second kind of order 1. See `bessel(3m)`, on whose implementation the function depends.

#### BesYN Intrinsic

    BesYN(N, X)

BesYN: `REAL` function, the ``KIND='` value of the type being that of argument X.

N: `INTEGER`; scalar; INTENT(IN).

X: `REAL`; scalar; INTENT(IN).

Intrinsic groups: `unix`.

Description:

Calculates the Bessel function of the second kind of order N. See `bessel(3m)`, on whose implementation the function depends.

#### Bit_Size Intrinsic

    Bit_Size(I)

Bit_Size: `INTEGER` function, the ``KIND='` value of the type being that of argument I.

I: `INTEGER`; scalar.

Intrinsic groups: `f90`.

Description:

Returns the number of bits (integer precision plus sign bit) represented by the type for I.

See section BTest Intrinsic, for how to test the value of a bit in a variable or array.

See section IBSet Intrinsic, for how to set a bit in a variable or array to 1.

#### BTest Intrinsic

    BTest(I, Pos)

BTest: `LOGICAL(KIND=1)` function.

I: `INTEGER`; scalar; INTENT(IN).

Pos: `INTEGER`; scalar; INTENT(IN).

Intrinsic groups: `mil`, `f90`, `vxt`.

Description:

Returns `.TRUE.` if bit Pos in I is 1, `.FALSE.` otherwise.

(Bit 0 is the low-order bit, adding the value 2**0, or 1, to the number if set to 1; bit 1 is the next-higher-order bit, adding 2**1, or 2; bit 2 adds 2**2, or 4; and so on.)

See section Bit_Size Intrinsic, for how to obtain the number of bits in a type.

#### CAbs Intrinsic

    CAbs(A)

CAbs: `REAL(KIND=1)` function.

A: `COMPLEX(KIND=1)`; scalar; INTENT(IN).

Intrinsic groups: (standard FORTRAN 77).

Description:

Archaic form of `ABS()` that is specific to one type for A. See section Abs Intrinsic.

#### CCos Intrinsic

    CCos(X)

CCos: `COMPLEX(KIND=1)` function.

X: `COMPLEX(KIND=1)`; scalar; INTENT(IN).

Intrinsic groups: (standard FORTRAN 77).

#### CExp Intrinsic

    CExp(X)

CExp: `COMPLEX(KIND=1)` function.

X: `COMPLEX(KIND=1)`; scalar; INTENT(IN).

Intrinsic groups: (standard FORTRAN 77).

#### Char Intrinsic

    Char(I)

Char: `CHARACTER*1` function.

I: `INTEGER`; scalar; INTENT(IN).

Intrinsic groups: (standard FORTRAN 77).

Description:

Returns the character corresponding to the code specified by I, using the system's native character set.

Because the system's native character set is used, the correspondence between character and their codes is not necessarily the same between GNU Fortran implementations.

See section IChar Intrinsic, for the inverse function.

See section AChar Intrinsic, for the function corresponding to the ASCII character set.

#### ChDir Intrinsic

    CALL ChDir(Dir, Status)

Dir: `CHARACTER`; scalar; INTENT(IN).

Status: `INTEGER(KIND=1)`; OPTIONAL; scalar; INTENT(OUT).

Intrinsic groups: `unix`.

Description:

Sets the current working directory to be Dir. If the Status argument is supplied, it contains 0 on success or an error code otherwise upon return. See `chdir(3)`.

#### ChMod Intrinsic

    CALL ChMod(Name, Mode, Status)

Name: `CHARACTER`; scalar; INTENT(IN).

Mode: `CHARACTER`; scalar; INTENT(IN).

Status: `INTEGER`; OPTIONAL; scalar; INTENT(OUT).

Intrinsic groups: `unix`.

Description:

Changes the access mode of file Name according to the specification Mode, which is given in the format of `chmod(1)`. If the Status argument is supplied, it contains 0 on success or an error code otherwise upon return. Note that this currently works by actually invoking `/bin/chmod` (or the `chmod` found when the library was configured) and so may fail in some circumstances and will, anyway, be slow.

#### CLog Intrinsic

    CLog(X)

CLog: `COMPLEX(KIND=1)` function.

X: `COMPLEX(KIND=1)`; scalar; INTENT(IN).

Intrinsic groups: (standard FORTRAN 77).

Description:

Archaic form of `LOG()` that is specific to one type for X. See section Log Intrinsic.

#### Cmplx Intrinsic

    Cmplx(X, Y)

Cmplx: `COMPLEX(KIND=1)` function.

X: `INTEGER`, `REAL`, or `COMPLEX`; scalar; INTENT(IN).

Y: `INTEGER` or `REAL`; OPTIONAL (must be omitted if X is `COMPLEX`); scalar; INTENT(IN).

Intrinsic groups: (standard FORTRAN 77).

Description:

If X is not type `COMPLEX`, constructs a value of type `COMPLEX(KIND=1)` from the real and imaginary values specified by X and Y, respectively. If Y is omitted, ``0.'` is assumed.

If X is type `COMPLEX`, converts it to type `COMPLEX(KIND=1)`.

See section Complex Intrinsic, for information on easily constructing a `COMPLEX` value of arbitrary precision from `REAL` arguments.

#### Complex Intrinsic

    Complex(Real, Imag)

Complex: `COMPLEX` function, the exact type being the result of cross-promoting the types of all the arguments.

Real: `INTEGER` or `REAL`; scalar; INTENT(IN).

Imag: `INTEGER` or `REAL`; scalar; INTENT(IN).

Intrinsic groups: `gnu`.

Description:

Returns a `COMPLEX` value that has ``Real'` and ``Imag'` as its real and imaginary parts, respectively.

If Real and Imag are the same type, and that type is not `INTEGER`, no data conversion is performed, and the type of the resulting value has the same kind value as the types of Real and Imag.

If Real and Imag are not the same type, the usual type-promotion rules are applied to both, converting either or both to the appropriate `REAL` type. The type of the resulting value has the same kind value as the type to which both Real and Imag were converted, in this case.

If Real and Imag are both `INTEGER`, they are both converted to `REAL(KIND=1)`, and the result of the `COMPLEX()` invocation is type `COMPLEX(KIND=1)`.

Note: The way to do this in standard Fortran 90 is too hairy to describe here, but it is important to note that ``CMPLX(D1,D2)'` returns a `COMPLEX(KIND=1)` result even if ``D1'` and ``D2'` are type `REAL(KIND=2)`. Hence the availability of `COMPLEX()` in GNU Fortran.

#### Conjg Intrinsic

    Conjg(Z)

Conjg: `COMPLEX` function, the ``KIND='` value of the type being that of argument Z.

Z: `COMPLEX`; scalar; INTENT(IN).

Intrinsic groups: (standard FORTRAN 77).

Description:

Returns the complex conjugate:

    COMPLEX(REALPART(Z), -IMAGPART(Z))

#### Cos Intrinsic

    Cos(X)

Cos: `REAL` or `COMPLEX` function, the exact type being that of argument X.

X: `REAL` or `COMPLEX`; scalar; INTENT(IN).

Intrinsic groups: (standard FORTRAN 77).

#### CosH Intrinsic

    CosH(X)

CosH: `REAL` function, the ``KIND='` value of the type being that of argument X.

X: `REAL`; scalar; INTENT(IN).

Intrinsic groups: (standard FORTRAN 77).

#### CSin Intrinsic

    CSin(X)

CSin: `COMPLEX(KIND=1)` function.

X: `COMPLEX(KIND=1)`; scalar; INTENT(IN).

Intrinsic groups: (standard FORTRAN 77).

#### CSqRt Intrinsic

    CSqRt(X)

CSqRt: `COMPLEX(KIND=1)` function.

X: `COMPLEX(KIND=1)`; scalar; INTENT(IN).

Intrinsic groups: (standard FORTRAN 77).

#### CTime Intrinsic

    CTime(STime)

CTime: `CHARACTER*(*)` function.

STime: `INTEGER(KIND=2)`; scalar; INTENT(IN).

Intrinsic groups: `unix`.

Description:

Converts STime, a system time value, such as returned by `TIME()`, to a string of the form ``Sat Aug 19 18:13:14 1995'`.

See section Time Intrinsic.

#### DAbs Intrinsic

    DAbs(A)

DAbs: `REAL(KIND=2)` function.

A: `REAL(KIND=2)`; scalar; INTENT(IN).

Intrinsic groups: (standard FORTRAN 77).

Description:

Archaic form of `ABS()` that is specific to one type for A. See section Abs Intrinsic.

#### DACos Intrinsic

    DACos(X)

DACos: `REAL(KIND=2)` function.

X: `REAL(KIND=2)`; scalar; INTENT(IN).

Intrinsic groups: (standard FORTRAN 77).

Description:

Archaic form of `ACOS()` that is specific to one type for X. See section ACos Intrinsic.

#### DASin Intrinsic

    DASin(X)

DASin: `REAL(KIND=2)` function.

X: `REAL(KIND=2)`; scalar; INTENT(IN).

Intrinsic groups: (standard FORTRAN 77).

Description:

Archaic form of `ASIN()` that is specific to one type for X. See section ASin Intrinsic.

#### DATan Intrinsic

    DATan(X)

DATan: `REAL(KIND=2)` function.

X: `REAL(KIND=2)`; scalar; INTENT(IN).

Intrinsic groups: (standard FORTRAN 77).

Description:

Archaic form of `ATAN()` that is specific to one type for X. See section ATan Intrinsic.

#### DATan2 Intrinsic

    DATan2(Y, X)

DATan2: `REAL(KIND=2)` function.

Y: `REAL(KIND=2)`; scalar; INTENT(IN).

X: `REAL(KIND=2)`; scalar; INTENT(IN).

Intrinsic groups: (standard FORTRAN 77).

Description:

Archaic form of `ATAN2()` that is specific to one type for Y and X. See section ATan2 Intrinsic.

#### DbesJ0 Intrinsic

    DbesJ0(X)

DbesJ0: `REAL(KIND=2)` function.

X: `REAL(KIND=2)`; scalar; INTENT(IN).

Intrinsic groups: `unix`.

#### DbesJ1 Intrinsic

    DbesJ1(X)

DbesJ1: `REAL(KIND=2)` function.

X: `REAL(KIND=2)`; scalar; INTENT(IN).

Intrinsic groups: `unix`.

#### DbesJN Intrinsic

    DbesJN(N, X)

DbesJN: `REAL(KIND=2)` function.

N: `INTEGER`; scalar; INTENT(IN).

X: `REAL(KIND=2)`; scalar; INTENT(IN).

Intrinsic groups: `unix`.

#### DbesY0 Intrinsic

    DbesY0(X)

DbesY0: `REAL(KIND=2)` function.

X: `REAL(KIND=2)`; scalar; INTENT(IN).

Intrinsic groups: `unix`.

#### DbesY1 Intrinsic

    DbesY1(X)

DbesY1: `REAL(KIND=2)` function.

X: `REAL(KIND=2)`; scalar; INTENT(IN).

Intrinsic groups: `unix`.

#### DbesYN Intrinsic

    DbesYN(N, X)

DbesYN: `REAL(KIND=2)` function.

N: `INTEGER`; scalar; INTENT(IN).

X: `REAL(KIND=2)`; scalar; INTENT(IN).

Intrinsic groups: `unix`.

#### Dble Intrinsic

    Dble(A)

Dble: `REAL(KIND=2)` function.

A: `INTEGER`, `REAL`, or `COMPLEX`; scalar; INTENT(IN).

Intrinsic groups: (standard FORTRAN 77).

#### DCos Intrinsic

    DCos(X)

DCos: `REAL(KIND=2)` function.

X: `REAL(KIND=2)`; scalar; INTENT(IN).

Intrinsic groups: (standard FORTRAN 77).

#### DCosH Intrinsic

    DCosH(X)

DCosH: `REAL(KIND=2)` function.

X: `REAL(KIND=2)`; scalar; INTENT(IN).

Intrinsic groups: (standard FORTRAN 77).

#### DDiM Intrinsic

    DDiM(X, Y)

DDiM: `REAL(KIND=2)` function.

X: `REAL(KIND=2)`; scalar; INTENT(IN).

Y: `REAL(KIND=2)`; scalar; INTENT(IN).

Intrinsic groups: (standard FORTRAN 77).

#### DErF Intrinsic

    DErF(X)

DErF: `REAL(KIND=2)` function.

X: `REAL(KIND=2)`; scalar; INTENT(IN).

Intrinsic groups: `unix`.

#### DErFC Intrinsic

    DErFC(X)

DErFC: `REAL(KIND=2)` function.

X: `REAL(KIND=2)`; scalar; INTENT(IN).

Intrinsic groups: `unix`.

#### DExp Intrinsic

    DExp(X)

DExp: `REAL(KIND=2)` function.

X: `REAL(KIND=2)`; scalar; INTENT(IN).

Intrinsic groups: (standard FORTRAN 77).

#### DiM Intrinsic

    DiM(X, Y)

DiM: `INTEGER` or `REAL` function, the exact type being the result of cross-promoting the types of all the arguments.

X: `INTEGER` or `REAL`; scalar; INTENT(IN).

Y: `INTEGER` or `REAL`; scalar; INTENT(IN).

Intrinsic groups: (standard FORTRAN 77).

#### DInt Intrinsic

    DInt(A)

DInt: `REAL(KIND=2)` function.

A: `REAL(KIND=2)`; scalar; INTENT(IN).

Intrinsic groups: (standard FORTRAN 77).

Description:

Archaic form of `AINT()` that is specific to one type for A. See section AInt Intrinsic.

#### DLog Intrinsic

    DLog(X)

DLog: `REAL(KIND=2)` function.

X: `REAL(KIND=2)`; scalar; INTENT(IN).

Intrinsic groups: (standard FORTRAN 77).

Description:

Archaic form of `LOG()` that is specific to one type for X. See section Log Intrinsic.

#### DLog10 Intrinsic

    DLog10(X)

DLog10: `REAL(KIND=2)` function.

X: `REAL(KIND=2)`; scalar; INTENT(IN).

Intrinsic groups: (standard FORTRAN 77).

Description:

Archaic form of `LOG10()` that is specific to one type for X. See section Log10 Intrinsic.

#### DMax1 Intrinsic

    DMax1(A-1, A-2, ..., A-n)

DMax1: `REAL(KIND=2)` function.

A: `REAL(KIND=2)`; at least two such arguments must be provided; scalar; INTENT(IN).

Intrinsic groups: (standard FORTRAN 77).

Description:

Archaic form of `MAX()` that is specific to one type for A. See section Max Intrinsic.

#### DMin1 Intrinsic

    DMin1(A-1, A-2, ..., A-n)

DMin1: `REAL(KIND=2)` function.

A: `REAL(KIND=2)`; at least two such arguments must be provided; scalar; INTENT(IN).

Intrinsic groups: (standard FORTRAN 77).

Description:

Archaic form of `MIN()` that is specific to one type for A. See section Min Intrinsic.

#### DMod Intrinsic

    DMod(A, P)

DMod: `REAL(KIND=2)` function.

A: `REAL(KIND=2)`; scalar; INTENT(IN).

P: `REAL(KIND=2)`; scalar; INTENT(IN).

Intrinsic groups: (standard FORTRAN 77).

Description:

Archaic form of `MOD()` that is specific to one type for A. See section Mod Intrinsic.

#### DNInt Intrinsic

    DNInt(A)

DNInt: `REAL(KIND=2)` function.

A: `REAL(KIND=2)`; scalar; INTENT(IN).

Intrinsic groups: (standard FORTRAN 77).

Description:

Archaic form of `ANINT()` that is specific to one type for A. See section ANInt Intrinsic.

#### DProd Intrinsic

    DProd(X, Y)

DProd: `REAL(KIND=2)` function.

X: `REAL(KIND=1)`; scalar; INTENT(IN).

Y: `REAL(KIND=1)`; scalar; INTENT(IN).

Intrinsic groups: (standard FORTRAN 77).

#### DSign Intrinsic

    DSign(A, B)

DSign: `REAL(KIND=2)` function.

A: `REAL(KIND=2)`; scalar; INTENT(IN).

B: `REAL(KIND=2)`; scalar; INTENT(IN).

Intrinsic groups: (standard FORTRAN 77).

#### DSin Intrinsic

    DSin(X)

DSin: `REAL(KIND=2)` function.

X: `REAL(KIND=2)`; scalar; INTENT(IN).

Intrinsic groups: (standard FORTRAN 77).

#### DSinH Intrinsic

    DSinH(X)

DSinH: `REAL(KIND=2)` function.

X: `REAL(KIND=2)`; scalar; INTENT(IN).

Intrinsic groups: (standard FORTRAN 77).

#### DSqRt Intrinsic

    DSqRt(X)

DSqRt: `REAL(KIND=2)` function.

X: `REAL(KIND=2)`; scalar; INTENT(IN).

Intrinsic groups: (standard FORTRAN 77).

#### DTan Intrinsic

    DTan(X)

DTan: `REAL(KIND=2)` function.

X: `REAL(KIND=2)`; scalar; INTENT(IN).

Intrinsic groups: (standard FORTRAN 77).

#### DTanH Intrinsic

    DTanH(X)

DTanH: `REAL(KIND=2)` function.

X: `REAL(KIND=2)`; scalar; INTENT(IN).

Intrinsic groups: (standard FORTRAN 77).

#### Dtime Intrinsic

    Dtime(TArray)

Dtime: `REAL(KIND=1)` function.

TArray: `REAL(KIND=1)`; DIMENSION(2); INTENT(OUT).

Intrinsic groups: `unix`.

Description:

Initially, return in seconds the runtime (since the start of the process' execution) as the function value and the user and system components of this in ``TArray(1)'` and ``TArray(2)'` respectively. The functions' value is equal to ``TArray(1) + ``TArray'`(2)'`.

Subsequent invocations of ``DTIME()'` return values accumulated since the previous invocation.

#### ErF Intrinsic

    ErF(X)

ErF: `REAL` function, the ``KIND='` value of the type being that of argument X.

X: `REAL`; scalar; INTENT(IN).

Intrinsic groups: `unix`.

Description:

Returns the error function of X. See `erf(3m)`, which provides the implementation.

#### ErFC Intrinsic

    ErFC(X)

ErFC: `REAL` function, the ``KIND='` value of the type being that of argument X.

X: `REAL`; scalar; INTENT(IN).

Intrinsic groups: `unix`.

Description:

Returns the complementary error function of X: `ERFC(R) = 1 - ERF(R)` (except that the result may be more accurate than explicitly evaluating that formulae would give). See `erfc(3m)`, which provides the implementation.

#### ETime Intrinsic

    ETime(TArray)

ETime: `REAL(KIND=1)` function.

TArray: `REAL(KIND=1)`; DIMENSION(2); INTENT(OUT).

Intrinsic groups: `unix`.

Description:

Return in seconds the runtime (since the start of the process' execution) as the function value and the user and system components of this in ``TArray(1)'` and ``TArray(2)'` respectively. The functions' value is equal to ``TArray(1) + TArray(2)'`.

#### Exit Intrinsic

    CALL Exit(Status)

Status: `INTEGER`; OPTIONAL; scalar; INTENT(IN).

Intrinsic groups: `unix`.

Description:

Exit the program with status Status after closing open Fortran i/o units and otherwise behaving as `exit(2)`. If Status is omitted the canonical `success' value will be returned to the system.

#### Exp Intrinsic

    Exp(X)

Exp: `REAL` or `COMPLEX` function, the exact type being that of argument X.

X: `REAL` or `COMPLEX`; scalar; INTENT(IN).

Intrinsic groups: (standard FORTRAN 77).

#### Fdate Intrinsic

    Fdate()

Fdate: `CHARACTER*(*)` function.

Intrinsic groups: `unix`.

Description:

Returns the current date in the same format as `CTIME()`.

Equivalent to:

    CTIME(TIME())

See section CTime Intrinsic.

#### FGetC Intrinsic

    CALL FGetC(Unit, C, Status)

Unit: `INTEGER`; scalar; INTENT(IN).

C: `CHARACTER`; scalar; INTENT(OUT).

Status: `INTEGER`; scalar; INTENT(OUT).

Intrinsic groups: `unix`.

#### Float Intrinsic

    Float(A)

Float: `REAL(KIND=1)` function.

A: `INTEGER`; scalar; INTENT(IN).

Intrinsic groups: (standard FORTRAN 77).

#### Flush Intrinsic

    CALL Flush(Unit)

Unit: `INTEGER`; OPTIONAL; scalar; INTENT(IN).

Intrinsic groups: `unix`.

Description:

Flushes Fortran unit(s) currently open for output. Without the optional argument, all such units are flushed, otherwise just the unit specified by Unit.

#### FNum Intrinsic

    FNum(Unit)

FNum: `INTEGER(KIND=1)` function.

Unit: `INTEGER`; scalar; INTENT(IN).

Intrinsic groups: `unix`.

Description:

Returns the Unix file descriptor number corresponding to the open Fortran I/O unit Unit. This could be passed to an interface to C I/O routines.

#### FPutC Intrinsic

    CALL FPutC(Unit, C, Status)

Unit: `INTEGER`; scalar; INTENT(IN).

C: `CHARACTER`; scalar; INTENT(IN).

Status: `INTEGER`; scalar; INTENT(OUT).

Intrinsic groups: `unix`.

#### FSeek Intrinsic

    CALL FSeek(Unit, Offset, Whence, ErrLab)

Unit: `INTEGER`; scalar; INTENT(IN).

Offset: `INTEGER`; scalar; INTENT(IN).

Whence: `INTEGER`; scalar; INTENT(IN).

ErrLab: ``*label'`, where label is the label of an executable statement; OPTIONAL.

Intrinsic groups: `unix`.

Description:

Attempts to move Fortran unit Unit to the specified Offset: absolute offset if Offset=0; relative to the current offset if Offset=1; relative to the end of the file if Offset=2. It branches to label Whence if Unit is not open or if the call otherwise fails.

#### FStat Intrinsic

    FStat(Unit, SArray)

FStat: `INTEGER(KIND=1)` function.

Unit: `INTEGER`; scalar; INTENT(IN).

SArray: `INTEGER(KIND=1)`; DIMENSION(13); INTENT(OUT).

Intrinsic groups: `unix`.

Description:

Obtains data about the file open on Fortran I/O unit Unit and places them in the array SArray. The values in this array are extracted from the `stat` structure as returned by `fstat(2)` q.v., as follows:

1. File mode
2. Inode number
3. ID of device containing directory entry for file
4. Device id (if relevant)
5. Number of links
6. Owner's uid
7. Owner's gid
8. File size (bytes)
9. Last access time
10. Last modification time
11. Last file status change time
12. Preferred i/o block size
13. Number of blocks allocated

Not all these elements are relevant on all systems. If an element is not relevant, it is returned as 0.

Returns 0 on success, otherwise an error number.

#### FTell Intrinsic

    FTell(Unit)

FTell: `INTEGER(KIND=1)` function.

Unit: `INTEGER`; scalar; INTENT(IN).

Intrinsic groups: `unix`.

Description:

Returns the current offset of Fortran unit Unit (or -1 if Unit is not open).

#### GError Intrinsic

    CALL GError(Message)

Message: `CHARACTER`; scalar; INTENT(OUT).

Intrinsic groups: `unix`.

Description:

Returns the system error message corresponding to the last system error (C `errno`).

#### GetArg Intrinsic

    CALL GetArg(Pos, Value)

Pos: `INTEGER`; scalar; INTENT(IN).

Value: `CHARACTER`; scalar; INTENT(OUT).

Intrinsic groups: `unix`.

Description:

Sets Value to the Pos-th command-line argument (or to all blanks if there are fewer than Value command-line arguments); `CALL GETARG(0, value)` sets value to the name of the program (on systems that support this feature).

See section IArgC Intrinsic, for information on how to get the number of arguments.

#### GetCWD Intrinsic

    GetCWD(Name)

GetCWD: `INTEGER(KIND=1)` function.

Name: `CHARACTER`; scalar; INTENT(OUT).

Intrinsic groups: `unix`.

Description:

Places the current working directory in Name. Returns 0 on success, otherwise an error code.

#### GetEnv Intrinsic

    CALL GetEnv(Name, Value)

Name: `CHARACTER`; scalar; INTENT(IN).

Value: `CHARACTER`; scalar; INTENT(OUT).

Intrinsic groups: `unix`.

Description:

Sets Value to the value of environment variable given by the value of Name (`$name` in shell terms) or to blanks if `$name` has not been set.

#### GetGId Intrinsic

    GetGId()

GetGId: `INTEGER(KIND=1)` function.

Intrinsic groups: `unix`.

Description:

Returns the group id for the current process.

#### GetLog Intrinsic

    CALL GetLog(Login)

Login: `CHARACTER`; scalar; INTENT(OUT).

Intrinsic groups: `unix`.

Description:

Returns the login name for the process in Login.

#### GetPId Intrinsic

    GetPId()

GetPId: `INTEGER(KIND=1)` function.

Intrinsic groups: `unix`.

Description:

Returns the process id for the current process.

#### GetUId Intrinsic

    GetUId()

GetUId: `INTEGER(KIND=1)` function.

Intrinsic groups: `unix`.

Description:

Returns the user id for the current process.

#### GMTime Intrinsic

    CALL GMTime(STime, TArray)

STime: `INTEGER(KIND=1)`; scalar; INTENT(IN).

TArray: `INTEGER(KIND=1)`; DIMENSION(9); INTENT(OUT).

Intrinsic groups: `unix`.

Description:

Given a system time value STime, fills TArray with values extracted from it appropriate to the GMT time zone using `gmtime(3)`.

The array elements are as follows:

1. Seconds after the minute, range 0--59 or 0--61 to allow for leap seconds
2. Minutes after the hour, range 0--59
3. Hours past midnight, range 0--23
4. Day of month, range 0--31
5. Number of months since January, range 0--12
6. Number of days since Sunday, range 0--6
7. Years since 1900
8. Days since January 1
9. Daylight savings indicator: positive if daylight savings is in effect, zero if not, and negative if the information isn't available.

#### HostNm Intrinsic

    HostNm(Name)

HostNm: `INTEGER(KIND=1)` function.

Name: `CHARACTER`; scalar; INTENT(OUT).

Intrinsic groups: `unix`.

Description:

Fills Name with the system's host name returned by `gethostname(2)`, returning 0 on success or an error code. This function is not available on all systems.

#### IAbs Intrinsic

    IAbs(A)

IAbs: `INTEGER(KIND=1)` function.

A: `INTEGER(KIND=1)`; scalar; INTENT(IN).

Intrinsic groups: (standard FORTRAN 77).

Description:

Archaic form of `ABS()` that is specific to one type for A. See section Abs Intrinsic.

#### IAChar Intrinsic

    IAChar(C)

IAChar: `INTEGER(KIND=1)` function.

C: `CHARACTER`; scalar; INTENT(IN).

Intrinsic groups: `f2c`, `f90`.

Description:

Returns the code for the ASCII character in the first character position of C.

See section AChar Intrinsic, for the inverse function.

See section IChar Intrinsic, for the function corresponding to the system's native character set.

#### IAnd Intrinsic

    IAnd(I, J)

IAnd: `INTEGER` function, the exact type being the result of cross-promoting the types of all the arguments.

I: `INTEGER`; scalar; INTENT(IN).

J: `INTEGER`; scalar; INTENT(IN).

Intrinsic groups: `mil`, `f90`, `vxt`.

Description:

Returns value resulting from boolean AND of pair of bits in each of I and J.

#### IArgC Intrinsic

    IArgC()

IArgC: `INTEGER(KIND=1)` function.

Intrinsic groups: `unix`.

Description:

Returns the number of command-line arguments.

This count does not include the specification of the program name itself.

#### IBClr Intrinsic

    IBClr(I, Pos)

IBClr: `INTEGER` function, the ``KIND='` value of the type being that of argument I.

I: `INTEGER`; scalar; INTENT(IN).

Pos: `INTEGER`; scalar; INTENT(IN).

Intrinsic groups: `mil`, `f90`, `vxt`.

#### IBits Intrinsic

    IBits(I, Pos, Len)

IBits: `INTEGER` function, the ``KIND='` value of the type being that of argument I.

I: `INTEGER`; scalar; INTENT(IN).

Pos: `INTEGER`; scalar; INTENT(IN).

Len: `INTEGER`; scalar; INTENT(IN).

Intrinsic groups: `mil`, `f90`, `vxt`.

#### IBSet Intrinsic

    IBSet(I, Pos)

IBSet: `INTEGER` function, the ``KIND='` value of the type being that of argument I.

I: `INTEGER`; scalar; INTENT(IN).

Pos: `INTEGER`; scalar; INTENT(IN).

Intrinsic groups: `mil`, `f90`, `vxt`.

#### IChar Intrinsic

    IChar(C)

IChar: `INTEGER(KIND=1)` function.

C: `CHARACTER`; scalar; INTENT(IN).

Intrinsic groups: (standard FORTRAN 77).

Description:

Returns the code for the character in the first character position of C.

Because the system's native character set is used, the correspondence between character and their codes is not necessarily the same between GNU Fortran implementations.

See section Char Intrinsic, for the inverse function.

See section IAChar Intrinsic, for the function corresponding to the ASCII character set.

#### IDate Intrinsic

    CALL IDate(TArray)

TArray: `INTEGER(KIND=1)`; DIMENSION(3); INTENT(OUT).

Intrinsic groups: `unix`.

Description:

Fills TArray with the numerical values at the current local time of day, month (in the range 1--12), and year in elements 1, 2, and 3, respectively. The year has four significant digits.

#### IDiM Intrinsic

    IDiM(X, Y)

IDiM: `INTEGER(KIND=1)` function.

X: `INTEGER(KIND=1)`; scalar; INTENT(IN).

Y: `INTEGER(KIND=1)`; scalar; INTENT(IN).

Intrinsic groups: (standard FORTRAN 77).

#### IDInt Intrinsic

    IDInt(A)

IDInt: `INTEGER(KIND=1)` function.

A: `REAL(KIND=2)`; scalar; INTENT(IN).

Intrinsic groups: (standard FORTRAN 77).

Description:

Archaic form of `INT()` that is specific to one type for A. See section Int Intrinsic.

#### IDNInt Intrinsic

    IDNInt(A)

IDNInt: `INTEGER(KIND=1)` function.

A: `REAL(KIND=2)`; scalar; INTENT(IN).

Intrinsic groups: (standard FORTRAN 77).

Description:

Archaic form of `NINT()` that is specific to one type for A. See section NInt Intrinsic.

#### IEOr Intrinsic

    IEOr(I, J)

IEOr: `INTEGER` function, the exact type being the result of cross-promoting the types of all the arguments.

I: `INTEGER`; scalar; INTENT(IN).

J: `INTEGER`; scalar; INTENT(IN).

Intrinsic groups: `mil`, `f90`, `vxt`.

Description:

Returns value resulting from boolean exclusive-OR of pair of bits in each of I and J.

#### IErrNo Intrinsic

    IErrNo()

IErrNo: `INTEGER(KIND=1)` function.

Intrinsic groups: `unix`.

Description:

Returns the last system error number (corresponding to the C `errno`).

#### IFix Intrinsic

    IFix(A)

IFix: `INTEGER(KIND=1)` function.

A: `INTEGER`, `REAL`, or `COMPLEX`; scalar; INTENT(IN).

Intrinsic groups: (standard FORTRAN 77).

Description:

Returns A with the fractional portion of its magnitude truncated and its sign preserved, converted to type `INTEGER(KIND=1)`.

If A is type `COMPLEX`, its real part is truncated and converted.

See section NInt Intrinsic, for how to convert, rounded to nearest whole number.

See section AInt Intrinsic, for how to truncate to whole number without converting.

#### Imag Intrinsic

    Imag(Z)

Imag: `REAL` function, the ``KIND='` value of the type being that of argument Z.

Z: `COMPLEX`; scalar; INTENT(IN).

Intrinsic groups: `f2c`.

Description:

The imaginary part of Z is returned, without conversion.

Note: The way to do this in standard Fortran 90 is ``AIMAG(Z)'`. However, when, for example, Z is `DOUBLE COMPLEX`, ``AIMAG(Z)'` means something different for some compilers that are not true Fortran 90 compilers but offer some extensions standardized by Fortran 90 (such as the `DOUBLE COMPLEX` type, also known as `COMPLEX(KIND=2)`).

The advantage of `IMAG()` is that, while not necessarily more or less portable than `AIMAG()`, it is more likely to cause a compiler that doesn't support it to produce a diagnostic than generate incorrect code.

See section `REAL()` and `AIMAG()` of Complex, for more information.

#### ImagPart Intrinsic

    ImagPart(Z)

ImagPart: `REAL` function, the ``KIND='` value of the type being that of argument Z.

Z: `COMPLEX`; scalar; INTENT(IN).

Intrinsic groups: `gnu`.

Description:

The imaginary part of Z is returned, without conversion.

Note: The way to do this in standard Fortran 90 is ``AIMAG(Z)'`. However, when, for example, Z is `DOUBLE COMPLEX`, ``AIMAG(Z)'` means something different for some compilers that are not true Fortran 90 compilers but offer some extensions standardized by Fortran 90 (such as the `DOUBLE COMPLEX` type, also known as `COMPLEX(KIND=2)`).

The advantage of `IMAGPART()` is that, while not necessarily more or less portable than `AIMAG()`, it is more likely to cause a compiler that doesn't support it to produce a diagnostic than generate incorrect code.

See section `REAL()` and `AIMAG()` of Complex, for more information.

#### Index Intrinsic

    Index(String, Substring)

Index: `INTEGER(KIND=1)` function.

String: `CHARACTER`; scalar; INTENT(IN).

Substring: `CHARACTER`; scalar; INTENT(IN).

Intrinsic groups: (standard FORTRAN 77).

#### Int Intrinsic

    Int(A)

Int: `INTEGER(KIND=1)` function.

A: `INTEGER`, `REAL`, or `COMPLEX`; scalar; INTENT(IN).

Intrinsic groups: (standard FORTRAN 77).

Description:

Returns A with the fractional portion of its magnitude truncated and its sign preserved, converted to type `INTEGER(KIND=1)`.

If A is type `COMPLEX`, its real part is truncated and converted.

See section NInt Intrinsic, for how to convert, rounded to nearest whole number.

See section AInt Intrinsic, for how to truncate to whole number without converting.

#### IOr Intrinsic

    IOr(I, J)

IOr: `INTEGER` function, the exact type being the result of cross-promoting the types of all the arguments.

I: `INTEGER`; scalar; INTENT(IN).

J: `INTEGER`; scalar; INTENT(IN).

Intrinsic groups: `mil`, `f90`, `vxt`.

Description:

Returns value resulting from boolean OR of pair of bits in each of I and J.

#### IRand Intrinsic

    IRand(Flag)

IRand: `INTEGER(KIND=1)` function.

Flag: `INTEGER`; OPTIONAL; scalar; INTENT(IN).

Intrinsic groups: `unix`.

Description:

Returns a uniform quasi-random number up to a system-dependent limit. If Flag is 0, the next number in sequence is returned; if Flag is 1, the generator is restarted by calling the UNIX function ``srand(0)'`; if Flag has any other value, it is used as a new seed with `srand()`.

See section SRand Intrinsic.

Note: As typically implemented (by the routine of the same name in the C library), this random number generator is a very poor one, though the BSD and GNU libraries provide a much better implementation than the `traditional' one. On a different system you almost certainly want to use something better.

#### IsaTty Intrinsic

    IsaTty(Unit)

IsaTty: `LOGICAL(KIND=1)` function.

Unit: `INTEGER`; scalar; INTENT(IN).

Intrinsic groups: `unix`.

Description:

Returns `.TRUE.` if and only if the Fortran I/O unit specified by Unit is connected to a terminal device. See `isatty(3)`.

#### IShft Intrinsic

    IShft(I, Shift)

IShft: `INTEGER` function, the ``KIND='` value of the type being that of argument I.

I: `INTEGER`; scalar; INTENT(IN).

Shift: `INTEGER`; scalar; INTENT(IN).

Intrinsic groups: `mil`, `f90`, `vxt`.

#### IShftC Intrinsic

    IShftC(I, Shift, Size)

IShftC: `INTEGER` function, the ``KIND='` value of the type being that of argument I.

I: `INTEGER`; scalar; INTENT(IN).

Shift: `INTEGER`; scalar; INTENT(IN).

Size: `INTEGER`; scalar; INTENT(IN).

Intrinsic groups: `mil`, `f90`, `vxt`.

#### ISign Intrinsic

    ISign(A, B)

ISign: `INTEGER(KIND=1)` function.

A: `INTEGER(KIND=1)`; scalar; INTENT(IN).

B: `INTEGER(KIND=1)`; scalar; INTENT(IN).

Intrinsic groups: (standard FORTRAN 77).

#### ITime Intrinsic

    CALL ITime(TArray)

TArray: `INTEGER(KIND=1)`; DIMENSION(3); INTENT(OUT).

Intrinsic groups: `unix`.

Description:

Returns the current local time hour, minutes, and seconds in elements 1, 2, and 3 of TArray, respectively.

#### Kill Intrinsic

    CALL Kill(Pid, Signal, Status)

Pid: `INTEGER`; scalar; INTENT(IN).

Signal: `INTEGER`; scalar; INTENT(IN).

Status: `INTEGER`; OPTIONAL; scalar; INTENT(OUT).

Intrinsic groups: `unix`.

Description:

Sends the signal specified by Signal to the process Pid. Returns zero on success, otherwise an error number. See `kill(2)`.

#### Len Intrinsic

    Len(String)

Len: `INTEGER(KIND=1)` function.

String: `CHARACTER`; scalar.

Intrinsic groups: (standard FORTRAN 77).

#### Len_Trim Intrinsic

    Len_Trim(String)

Len_Trim: `INTEGER(KIND=1)` function.

String: `CHARACTER`; scalar; INTENT(IN).

Intrinsic groups: `f90`.

Description:

Returns the index of the last non-blank character in String. `LNBLNK` and `LEN_TRIM` are equivalent.

#### LGe Intrinsic

    LGe(String_A, String_B)

LGe: `LOGICAL(KIND=1)` function.

String_A: `CHARACTER`; scalar; INTENT(IN).

String_B: `CHARACTER`; scalar; INTENT(IN).

Intrinsic groups: (standard FORTRAN 77).

#### LGt Intrinsic

    LGt(String_A, String_B)

LGt: `LOGICAL(KIND=1)` function.

String_A: `CHARACTER`; scalar; INTENT(IN).

String_B: `CHARACTER`; scalar; INTENT(IN).

Intrinsic groups: (standard FORTRAN 77).

#### Link Intrinsic

    CALL Link(Path1, Path2, Status)

Path1: `CHARACTER`; scalar; INTENT(IN).

Path2: `CHARACTER`; scalar; INTENT(IN).

Status: `INTEGER`; OPTIONAL; scalar; INTENT(OUT).

Intrinsic groups: `unix`.

Description:

Makes a (hard) link from Path1 to Path2. If the Status argument is supplied, it contains 0 on success or an error code otherwise. See `link(2)`.

#### LLe Intrinsic

    LLe(String_A, String_B)

LLe: `LOGICAL(KIND=1)` function.

String_A: `CHARACTER`; scalar; INTENT(IN).

String_B: `CHARACTER`; scalar; INTENT(IN).

Intrinsic groups: (standard FORTRAN 77).

#### LLt Intrinsic

    LLt(String_A, String_B)

LLt: `LOGICAL(KIND=1)` function.

String_A: `CHARACTER`; scalar; INTENT(IN).

String_B: `CHARACTER`; scalar; INTENT(IN).

Intrinsic groups: (standard FORTRAN 77).

#### LnBlnk Intrinsic

    LnBlnk(String)

LnBlnk: `INTEGER(KIND=1)` function.

String: `CHARACTER`; scalar; INTENT(IN).

Intrinsic groups: `unix`.

Description:

Returns the index of the last non-blank character in String. `LNBLNK` and `LEN_TRIM` are equivalent.

#### Loc Intrinsic

    Loc(Entity)

Loc: `INTEGER(KIND=0)` function.

Entity: Any type; cannot be a constant or expression.

Intrinsic groups: `unix`.

Description:

The `LOC()` intrinsic works the same way as the `%LOC()` construct. See section The `%LOC()` Construct, for more information.

#### Log Intrinsic

    Log(X)

Log: `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 natural logarithm of X, which must be greater than zero or, if type `COMPLEX`, must not be zero.

See section Exp Intrinsic, for the inverse function.

See section Log10 Intrinsic, for the base-10 logarithm function.

#### Log10 Intrinsic

    Log10(X)

Log10: `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 natural logarithm of X, which must be greater than zero or, if type `COMPLEX`, must not be zero.

The inverse function is ``10. ** LOG10(X)'`.

See section Log Intrinsic, for the natural logarithm function.

#### Long Intrinsic

    Long(A)

Long: `INTEGER(KIND=1)` function.

A: `INTEGER`; scalar; INTENT(IN).

Intrinsic groups: `unix`.

#### LShift Intrinsic

    LShift(I, Shift)

LShift: `INTEGER` function, the ``KIND='` value of the type being that of argument I.

I: `INTEGER`; scalar; INTENT(IN).

Shift: `INTEGER`; scalar; INTENT(IN).

Intrinsic groups: `f2c`.

#### LStat Intrinsic

    LStat(File, SArray)

LStat: `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 and places them in the array SArray. If File is a symbolic link it returns data on the link itself, so the routine is available only on systems that support symbolic links. The values in this array are extracted from the `stat` structure as returned by `fstat(2)` q.v., as follows:

1. File mode
2. Inode number
3. ID of device containing directory entry for file
4. Device id (if relevant)
5. Number of links
6. Owner's uid
7. Owner's gid
8. File size (bytes)
9. Last access time
10. Last modification time
11. Last file status change time
12. Preferred i/o block size
13. Number of blocks allocated

Not all these elements are relevant on all systems. If an element is not relevant, it is returned as 0.

Returns 0 on success, otherwise an error number.

#### LTime Intrinsic

    CALL LTime(STime, TArray)

STime: `INTEGER(KIND=1)`; scalar; INTENT(IN).

TArray: `INTEGER(KIND=1)`; DIMENSION(9); INTENT(OUT).

Intrinsic groups: `unix`.

Description:

Given a system time value STime, fills TArray with values extracted from it appropriate to the GMT time zone using `localtime(3)`.

The array elements are as follows:

1. Seconds after the minute, range 0--59 or 0--61 to allow for leap seconds
2. Minutes after the hour, range 0--59
3. Hours past midnight, range 0--23
4. Day of month, range 0--31
5. Number of months since January, range 0--12
6. Number of days since Sunday, range 0--6
7. Years since 1900
8. Days since January 1
9. Daylight savings indicator: positive if daylight savings is in effect, zero if not, and negative if the information isn't available.

#### Max Intrinsic

    Max(A-1, A-2, ..., A-n)

Max: `INTEGER` or `REAL` function, the exact type being the result of cross-promoting the types of all the arguments.

A: `INTEGER` or `REAL`; at least two such arguments must be provided; scalar; INTENT(IN).

Intrinsic groups: (standard FORTRAN 77).

Description:

Returns the argument with the largest value.

See section Min Intrinsic, for the opposite function.

#### Max0 Intrinsic

    Max0(A-1, A-2, ..., A-n)

Max0: `INTEGER(KIND=1)` function.

A: `INTEGER(KIND=1)`; at least two such arguments must be provided; scalar; INTENT(IN).

Intrinsic groups: (standard FORTRAN 77).

Description:

Archaic form of `MAX()` that is specific to one type for A. See section Max Intrinsic.

#### Max1 Intrinsic

    Max1(A-1, A-2, ..., A-n)

Max1: `INTEGER(KIND=1)` function.

A: `REAL(KIND=1)`; at least two such arguments must be provided; scalar; INTENT(IN).

Intrinsic groups: (standard FORTRAN 77).

Description:

Archaic form of `MAX()` that is specific to one type for A and a different return type. See section Max Intrinsic.

#### MClock Intrinsic

    MClock()

MClock: `INTEGER(KIND=2)` function.

Intrinsic groups: `unix`.

Description:

Returns the number of clock ticks since the start of the process. Only defined on systems with `clock(3)` (q.v.).

#### Min Intrinsic

    Min(A-1, A-2, ..., A-n)

Min: `INTEGER` or `REAL` function, the exact type being the result of cross-promoting the types of all the arguments.

A: `INTEGER` or `REAL`; at least two such arguments must be provided; scalar; INTENT(IN).

Intrinsic groups: (standard FORTRAN 77).

Description:

Returns the argument with the smallest value.

See section Max Intrinsic, for the opposite function.

#### Min0 Intrinsic

    Min0(A-1, A-2, ..., A-n)

Min0: `INTEGER(KIND=1)` function.

A: `INTEGER(KIND=1)`; at least two such arguments must be provided; scalar; INTENT(IN).

Intrinsic groups: (standard FORTRAN 77).

Description:

Archaic form of `MIN()` that is specific to one type for A. See section Min Intrinsic.

#### Min1 Intrinsic

    Min1(A-1, A-2, ..., A-n)

Min1: `INTEGER(KIND=1)` function.

A: `REAL(KIND=1)`; at least two such arguments must be provided; scalar; INTENT(IN).

Intrinsic groups: (standard FORTRAN 77).

Description:

Archaic form of `MIN()` that is specific to one type for A and a different return type. See section Min Intrinsic.

#### Mod Intrinsic

    Mod(A, P)

Mod: `INTEGER` or `REAL` function, the exact type being the result of cross-promoting the types of all the arguments.

A: `INTEGER` or `REAL`; scalar; INTENT(IN).

P: `INTEGER` or `REAL`; scalar; INTENT(IN).

Intrinsic groups: (standard FORTRAN 77).

Description:

Returns remainder calculated as:

    A - (INT(A / P) * P)

P must not be zero.

#### MvBits Intrinsic

    CALL MvBits(From, FromPos, Len, TO, ToPos)

From: `INTEGER`; scalar; INTENT(IN).

FromPos: `INTEGER`; scalar; INTENT(IN).

Len: `INTEGER`; scalar; INTENT(IN).

TO: `INTEGER` with same ``KIND='` value as for From; scalar; INTENT(INOUT).

ToPos: `INTEGER`; scalar; INTENT(IN).

Intrinsic groups: `mil`, `f90`, `vxt`.

#### NInt Intrinsic

    NInt(A)

NInt: `INTEGER(KIND=1)` function.

A: `REAL`; scalar; INTENT(IN).

Intrinsic groups: (standard FORTRAN 77).

Description:

Returns A with the fractional portion of its magnitude eliminated by rounding to the nearest whole number and with its sign preserved, converted to type `INTEGER(KIND=1)`.

If A is type `COMPLEX`, its real part is rounded and converted.

A fractional portion exactly equal to ``.5'` is rounded to the whole number that is larger in magnitude. (Also called "Fortran round".)

See section Int Intrinsic, for how to convert, truncate to whole number.

See section ANInt Intrinsic, for how to round to nearest whole number without converting.

#### Not Intrinsic

    Not(I)

Not: `INTEGER` function, the ``KIND='` value of the type being that of argument I.

I: `INTEGER`; scalar; INTENT(IN).

Intrinsic groups: `mil`, `f90`, `vxt`.

Description:

Returns value resulting from boolean NOT of each bit in I.

#### Or Intrinsic

    Or(I, J)

Or: `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 OR of pair of bits in each of I and J.

#### PError Intrinsic

    CALL PError(String)

String: `CHARACTER`; scalar; INTENT(IN).

Intrinsic groups: `unix`.

Description:

Prints (on the C `stderr` stream) a newline-terminated error message corresponding to the last system error. This is prefixed by String, a colon and a space. See `perror(3)`.

#### Rand Intrinsic

    Rand(Flag)

Rand: `REAL(KIND=1)` function.

Flag: `INTEGER`; OPTIONAL; scalar; INTENT(IN).

Intrinsic groups: `unix`.

Description:

Returns a uniform quasi-random number between 0 and 1. If Flag is 0, the next number in sequence is returned; if Flag is 1, the generator is restarted by calling ``srand(0)'`; if Flag has any other value, it is used as a new seed with `srand`.

See section SRand Intrinsic.

Note: As typically implemented (by the routine of the same name in the C library), this random number generator is a very poor one, though the BSD and GNU libraries provide a much better implementation than the `traditional' one. On a different system you almost certainly want to use something better.

#### Real Intrinsic

    Real(A)

Real: `REAL` function. The exact type is ``REAL(KIND=1)'` when argument A is any type other than `COMPLEX`, or when it is `COMPLEX(KIND=1)`. When A is any `COMPLEX` type other than `COMPLEX(KIND=1)`, this intrinsic is valid only when used as the argument to `REAL()`, as explained below.

A: `INTEGER`, `REAL`, or `COMPLEX`; scalar; INTENT(IN).

Intrinsic groups: (standard FORTRAN 77).

Description:

Converts A to `REAL(KIND=1)`.

Use of `REAL()` with a `COMPLEX` argument (other than `COMPLEX(KIND=1)`) is restricted to the following case:

    REAL(REAL(A))

This expression converts the real part of A to `REAL(KIND=1)`.

See section `REAL()` and `AIMAG()` of Complex, for more information.

#### RealPart Intrinsic

    RealPart(Z)

RealPart: `REAL` function, the ``KIND='` value of the type being that of argument Z.

Z: `COMPLEX`; scalar; INTENT(IN).

Intrinsic groups: `gnu`.

Description:

The real part of Z is returned, without conversion.

Note: The way to do this in standard Fortran 90 is ``REAL(Z)'`. However, when, for example, Z is `COMPLEX(KIND=2)`, ``REAL(Z)'` means something different for some compilers that are not true Fortran 90 compilers but offer some extensions standardized by Fortran 90 (such as the `DOUBLE COMPLEX` type, also known as `COMPLEX(KIND=2)`).

The advantage of `REALPART()` is that, while not necessarily more or less portable than `REAL()`, it is more likely to cause a compiler that doesn't support it to produce a diagnostic than generate incorrect code.

See section `REAL()` and `AIMAG()` of Complex, for more information.

#### Rename Intrinsic

    CALL Rename(Path1, Path2, Status)

Path1: `CHARACTER`; scalar; INTENT(IN).

Path2: `CHARACTER`; scalar; INTENT(IN).

Status: `INTEGER`; OPTIONAL; scalar; INTENT(OUT).

Intrinsic groups: `unix`.

Description:

Renames the file Path1 to Path2. See `rename(2)`. If the Status argument is supplied, it contains 0 on success or an error code otherwise upon return.

#### RShift Intrinsic

    RShift(I, Shift)

RShift: `INTEGER` function, the ``KIND='` value of the type being that of argument I.

I: `INTEGER`; scalar; INTENT(IN).

Shift: `INTEGER`; scalar; INTENT(IN).

Intrinsic groups: `f2c`.

#### Second Intrinsic

    Second()

Second: `REAL(KIND=1)` function.

Intrinsic groups: `unix`.

Description:

Returns the process' runtime in seconds--the same value as the UNIX function `etime` returns.

This routine is known from Cray Fortran.

#### Second Intrinsic (Form SECOND (subroutine))

    CALL Second(Seconds)

Seconds: `REAL(KIND=1)`; scalar; INTENT(OUT).

Intrinsic groups: `unix`.

Description:

Returns the process' runtime in seconds in Seconds---the same value as the UNIX function `etime` returns.

This routine is known from Cray Fortran.

#### Short Intrinsic

    Short(A)

Short: `INTEGER(KIND=6)` function.

A: `INTEGER`; scalar; INTENT(IN).

Intrinsic groups: `unix`.

#### Sign Intrinsic

    Sign(A, B)

Sign: `INTEGER` or `REAL` function, the exact type being the result of cross-promoting the types of all the arguments.

A: `INTEGER` or `REAL`; scalar; INTENT(IN).

B: `INTEGER` or `REAL`; scalar; INTENT(IN).

Intrinsic groups: (standard FORTRAN 77).

#### Signal Intrinsic

    CALL Signal(Number, Handler)

Number: `INTEGER`; scalar; INTENT(IN).

Handler: Signal handler (`INTEGER FUNCTION` or `SUBROUTINE`) or dummy/global `INTEGER(KIND=1)` scalar.

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 Number is an integer it can be used to turn off handling of signal Handler or revert to its default action. See `signal(2)`.

Note that Handler will be called with C conventions, so its value in Fortran terms is obtained by applying `%loc` (or loc) to it.

#### 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).

#### 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).

#### 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)`.

#### Sngl Intrinsic

    Sngl(A)

Sngl: `REAL(KIND=1)` function.

A: `REAL(KIND=2)`; scalar; INTENT(IN).

Intrinsic groups: (standard FORTRAN 77).

#### 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).

#### SRand Intrinsic

    CALL SRand(Seed)

Seed: `INTEGER`; scalar; INTENT(IN).

Intrinsic groups: `unix`.

Description:

Reinitialises the generator with the seed in Seed. See section IRand Intrinsic. See section Rand Intrinsic.

#### Stat Intrinsic

    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 and places them in the array SArray. The values in this array are extracted from the `stat` structure as returned by `fstat(2)` q.v., as follows:

1. File mode
2. Inode number
3. ID of device containing directory entry for file
4. Device id (if relevant)
5. Number of links
6. Owner's uid
7. Owner's gid
8. File size (bytes)
9. Last access time
10. Last modification time
11. Last file status change time
12. Preferred i/o block size
13. Number of blocks allocated

Not all these elements are relevant on all systems. If an element is not relevant, it is returned as 0.

Returns 0 on success, otherwise an error number.

#### SymLnk Intrinsic

    CALL SymLnk(Path1, Path2, Status)

Path1: `CHARACTER`; scalar; INTENT(IN).

Path2: `CHARACTER`; scalar; INTENT(IN).

Status: `INTEGER`; OPTIONAL; scalar; INTENT(OUT).

Intrinsic groups: `unix`.

Description:

Makes a symbolic link from Path1 to Path2. If the Status argument is supplied, it contains 0 on success or an error code otherwise. Available only on systems that support symbolic links (see `symlink(2)`).

#### System Intrinsic

    CALL System(Command, Status)

Command: `CHARACTER`; scalar; INTENT(IN).

Status: `INTEGER(KIND=1)`; OPTIONAL; scalar; INTENT(IN).

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.

#### System_Clock Intrinsic

    CALL System_Clock(Count, Rate, Max)

Count: `INTEGER(KIND=1)`; scalar; INTENT(OUT).

Rate: `INTEGER(KIND=1)`; scalar; INTENT(OUT).

Max: `INTEGER(KIND=1)`; 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.

#### 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).

#### 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).

#### Time Intrinsic

    Time()

Time: `INTEGER(KIND=2)` 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`.

#### TtyNam Intrinsic

    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.

#### UMask Intrinsic

    CALL UMask(Mask, Old)

Mask: `INTEGER`; scalar; INTENT(IN).

Old: `INTEGER`; OPTIONAL; scalar; INTENT(OUT).

Intrinsic groups: `unix`.

Description:

Sets the file creation mask to Old and returns the old value in argument Old if it is supplied. See `umask(2)`.

#### Unlink Intrinsic

    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. If the Status argument is supplied, it contains 0 on success or an error code otherwise. See `unlink(2)`.

#### 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.

#### 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. See section Abs Intrinsic.

#### ZCos Intrinsic

    ZCos(X)

ZCos: `COMPLEX(KIND=2)` function.

X: `COMPLEX(KIND=2)`; scalar; INTENT(IN).

Intrinsic groups: `f2c`.

#### ZExp Intrinsic

    ZExp(X)

ZExp: `COMPLEX(KIND=2)` function.

X: `COMPLEX(KIND=2)`; scalar; INTENT(IN).

Intrinsic groups: `f2c`.

#### 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. See section Log Intrinsic.

#### ZSin Intrinsic

    ZSin(X)

ZSin: `COMPLEX(KIND=2)` function.

X: `COMPLEX(KIND=2)`; scalar; INTENT(IN).

Intrinsic groups: `f2c`.

#### ZSqRt Intrinsic

    ZSqRt(X)

ZSqRt: `COMPLEX(KIND=2)` function.

X: `COMPLEX(KIND=2)`; scalar; INTENT(IN).

Intrinsic groups: `f2c`.

## 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.)

### Underscores in Symbol Names

Underscores (``_'`) are accepted in symbol names after the first character (which must be a letter).

Go to the first, previous, next, last section, table of contents.