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 http://www.fortran.com/fortran/F77_std/rjcnf0001.html or as monolithic text at http://www.fortran.com/fortran/F77_std/f77_std.html. 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.

(If you need a text on Fortran, a few freely available electronic references have pointers from http://www.fortran.com/fortran/Books/. There is a `cooperative net project', User Notes on Fortran Programming at ftp://vms.huji.ac.il/fortran/ and mirrors elsewhere; some of this material might not apply specifically to g77.)

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 would 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:

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, heterogenous 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:

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:

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:

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

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:

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:

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

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:

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:

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.

Cpp-style directives

cpp output-style # directives (see section `C Preprocessor Output' in The C Preprocessor) are recognized by the compiler even when the preprocessor isn't run on the input (as it is when compiling `.F' files). (Note the distinction between these cpp # output directives and #line input directives.)

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:

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:

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

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 value is reserved for future use. The planned future use is for this value to designate, explicitly, context-sensitive kind-type selection. For example, the expression `1D0 * 0.1_0' would be equivalent to `1D0 * 0.1D0'.
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.
KIND=7
This is valid only as INTEGER(KIND=7) 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 *.)

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:

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.)

A prefix-radix constant, such as `Z'ABCD'', can optionally be treated as typeless. See section Options Controlling Fortran Dialect, for information on the `-ftypeless-boz' option.

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 spaces.

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=7).

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(%VAL(%LOC(I)))', and in fact might compile to identical code.

However, `CALL FOO(%VAL(%LOC(I)))' emphatically means "pass, by value, 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(%VAL(%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.

This follows Fortran 90 with the restriction that on NAMELIST input, subscripts must have the form

subscript [ : subscript [ : stride]]

i.e.

&xx x(1:3,8:10:2)=1,2,3,4,5,6/

is allowed, but not, say,

&xx x(:3,8::2)=1,2,3,4,5,6/

As an extension of the Fortran 90 form, $ and $END may be used in place of & and / in NAMELIST input, so that

$&xx x(1:3,8:10:2)=1,2,3,4,5,6 $end

could be used instead of the example above.

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. The Fortran 90 "do forever" statement comprising just DO is also supported.

END DO

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

This statement is used in one of two ways:

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:

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:

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 Version 1:
C Modified 1999-02-15 (Burley) to delete my email address.
C Modified 1997-05-21 (Burley) to accommodate compilers that implement
C INT(I1-I2) as INT(I1)-INT(I2) given INTEGER*2 I1,I2.
C
C Version 0:
C Written by James Craig Burley 1997-02-20.
C
C Purpose:
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
      INTEGER*2 ITMP
      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 Calculate result for first interpretation.
C
      I2 = (INT (ILARGE) - INT (ISMALL)) * ITWO + ITOOLG
C
C Calculate result for second interpretation.
C
      ITMP = ILARGE - ISMALL
      I3 = (INT (ITMP)) * ITWO + ITOOLG
C
C Calculate result for 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

No future version of the GNU Fortran language will likely permit specific intrinsic invocations with wrong-typed arguments (such as IDIM in the above example), since it has been determined that disagreements exist among many production compilers on the interpretation of such invocations. These disagreements strongly suggest that Fortran programmers, and certainly existing Fortran programs, disagree about the meaning of such invocations.

The first version of JCB002 didn't accommodate some compilers' treatment of `INT(I1-I2)' where `I1' and `I2' are INTEGER*2. In such a case, these compilers apparently convert both operands to INTEGER*4 and then do an INTEGER*4 subtraction, instead of doing an INTEGER*2 subtraction on the original values in `I1' and `I2'.

However, the results of the careful analyses done on the outputs of programs compiled by these various compilers show that they all implement either `Interp 1' or `Interp 2' above.

Specifically, it is believed that the new version of JCB002 above will confirm that:

If you get different results than the above for the stated compilers, or have results for other compilers that might be worth adding to the above list, 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))

(It was necessary for Fortran 90 to specify this behavior for DOUBLE PRECISION arguments, since that is the behavior mandated by FORTRAN 77.)

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, and g77 currently does not support it.

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:

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). A null character (`CHAR(0)') marks the end of the name in Name---otherwise, trailing blanks in Name are ignored. 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 of this 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 of this function.

AdjustL Intrinsic

This intrinsic is not yet implemented. The name is, however, reserved as an intrinsic. Use `EXTERNAL AdjustL' to use this name for an external procedure.

AdjustR Intrinsic

This intrinsic is not yet implemented. The name is, however, reserved as an intrinsic. Use `EXTERNAL AdjustR' to use this name for an external procedure.

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.

Alarm Intrinsic

CALL Alarm(Seconds, Handler, Status)

Seconds: INTEGER; scalar; INTENT(IN).

Handler: Signal handler (INTEGER FUNCTION or SUBROUTINE) or dummy/global INTEGER(KIND=1) scalar.

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

Intrinsic groups: unix.

Description:

Causes external subroutine Handler to be executed after a delay of Seconds seconds by using alarm(1) to set up a signal and signal(2) to catch it. If Status is supplied, it will be returned with the number of seconds remaining until any previously scheduled alarm was due to be delivered, or zero if there was no previously scheduled alarm. See section Signal Intrinsic (subroutine).

All Intrinsic

This intrinsic is not yet implemented. The name is, however, reserved as an intrinsic. Use `EXTERNAL All' to use this name for an external procedure.

Allocated Intrinsic

This intrinsic is not yet implemented. The name is, however, reserved as an intrinsic. Use `EXTERNAL Allocated' to use this name for an external procedure.

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.

Any Intrinsic

This intrinsic is not yet implemented. The name is, however, reserved as an intrinsic. Use `EXTERNAL Any' to use this name for an external procedure.

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 of this function.

Associated Intrinsic

This intrinsic is not yet implemented. The name is, however, reserved as an intrinsic. Use `EXTERNAL Associated' to use this name for an external procedure.

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 of this 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 of this 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 of X. 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 of X. 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 of X. 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 of X. 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 of X. 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 of X. 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 to 1.

See section IBClr Intrinsic, for how to set a bit in a variable to 0.

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 (rightmost) bit, adding the value or 1, to the number if set to 1; bit 1 is the next-higher-order bit, adding or 2; bit 2 adds or 4; and so on.)

See section Bit_Size Intrinsic, for how to obtain the number of bits in a type. The leftmost bit of I is `BIT_SIZE(I-1)'.

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).

Description:

Archaic form of COS() that is specific to one type for X. See section Cos Intrinsic.

Ceiling Intrinsic

This intrinsic is not yet implemented. The name is, however, reserved as an intrinsic. Use `EXTERNAL Ceiling' to use this name for an external procedure.

CExp Intrinsic

CExp(X)

CExp: COMPLEX(KIND=1) function.

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

Intrinsic groups: (standard FORTRAN 77).

Description:

Archaic form of EXP() that is specific to one type for X. See section Exp Intrinsic.

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.

Note that no intrinsic exists to convert a numerical value to a printable character string. For example, there is no intrinsic that, given an INTEGER or REAL argument with the value `154', returns the CHARACTER result `'154''.

Instead, you can use internal-file I/O to do this kind of conversion. For example:

INTEGER VALUE
CHARACTER*10 STRING
VALUE = 154
WRITE (STRING, '(I10)'), VALUE
PRINT *, STRING
END

The above program, when run, prints:

        154

See section IChar Intrinsic, for the inverse of the CHAR function.

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

ChDir Intrinsic (subroutine)

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 a non-zero error code otherwise upon return. See chdir(3).

Caution: Using this routine during I/O to a unit connected with a non-absolute file name can cause subsequent I/O on such a unit to fail because the I/O library might reopen files by name.

Some non-GNU implementations of Fortran provide this intrinsic as only a function, not as a subroutine, or do not support the (optional) Status argument.

For information on other intrinsics with the same name: See section ChDir Intrinsic (function).

ChMod Intrinsic (subroutine)

CALL ChMod(Name, Mode, Status)

Name: CHARACTER; scalar; INTENT(IN).

Mode: CHARACTER; scalar; INTENT(IN).

Status: INTEGER(KIND=1); 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). A null character (`CHAR(0)') marks the end of the name in Name---otherwise, trailing blanks in Name are ignored. Currently, Name must not contain the single quote character.

If the Status argument is supplied, it contains 0 on success or a non-zero error code upon return.

Note that this currently works by actually invoking /bin/chmod (or the chmod found when the library was configured) and so might fail in some circumstances and will, anyway, be slow.

Some non-GNU implementations of Fortran provide this intrinsic as only a function, not as a subroutine, or do not support the (optional) Status argument.

For information on other intrinsics with the same name: See section ChMod Intrinsic (function).

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).

Description:

Returns the cosine of X, an angle measured in radians.

See section ACos Intrinsic, for the inverse of this function.

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).

Description:

Returns the hyperbolic cosine of X.

Count Intrinsic

This intrinsic is not yet implemented. The name is, however, reserved as an intrinsic. Use `EXTERNAL Count' to use this name for an external procedure.

CPU_Time Intrinsic

CALL CPU_Time(Seconds)

Seconds: REAL; scalar; INTENT(OUT).

Intrinsic groups: f90.

Description:

Returns in Seconds the current value of the system time. This implementation of the Fortran 95 intrinsic is just an alias for second See section Second Intrinsic (subroutine).

On some systems, the underlying timings are represented using types with sufficiently small limits that overflows (wraparounds) are possible, such as 32-bit types. Therefore, the values returned by this intrinsic might be, or become, negative, or numerically less than previous values, during a single run of the compiled program.

CShift Intrinsic

This intrinsic is not yet implemented. The name is, however, reserved as an intrinsic. Use `EXTERNAL CShift' to use this name for an external procedure.

CSin Intrinsic

CSin(X)

CSin: COMPLEX(KIND=1) function.

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

Intrinsic groups: (standard FORTRAN 77).

Description:

Archaic form of SIN() that is specific to one type for X. See section Sin Intrinsic.

CSqRt Intrinsic

CSqRt(X)

CSqRt: COMPLEX(KIND=1) function.

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

Intrinsic groups: (standard FORTRAN 77).

Description:

Archaic form of SQRT() that is specific to one type for X. See section SqRt Intrinsic.

CTime Intrinsic (subroutine)

CALL CTime(STime, Result)

STime: INTEGER; scalar; INTENT(IN).

Result: CHARACTER; scalar; INTENT(OUT).

Intrinsic groups: unix.

Description:

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

See section Time8 Intrinsic.

Some non-GNU implementations of Fortran provide this intrinsic as only a function, not as a subroutine.

For information on other intrinsics with the same name: See section CTime Intrinsic (function).

CTime Intrinsic (function)

CTime(STime)

CTime: CHARACTER*(*) function.

STime: INTEGER; scalar; INTENT(IN).

Intrinsic groups: unix.

Description:

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

See section Time8 Intrinsic.

For information on other intrinsics with the same name: See section CTime Intrinsic (subroutine).

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.

Date_and_Time Intrinsic

CALL Date_and_Time(Date, Time, Zone, Values)

Date: CHARACTER; scalar; INTENT(OUT).

Time: CHARACTER; OPTIONAL; scalar; INTENT(OUT).

Zone: CHARACTER; OPTIONAL; scalar; INTENT(OUT).

Values: INTEGER(KIND=1); OPTIONAL; DIMENSION(8); INTENT(OUT).

Intrinsic groups: f90.

Description:

Returns:

Date
The date in the form ccyymmdd: century, year, month and day;
Time
The time in the form `hhmmss.ss': hours, minutes, seconds and milliseconds;
Zone
The difference between local time and UTC (GMT) in the form Shhmm: sign, hours and minutes, e.g. `-0500' (winter in New York);
Values
The year, month of the year, day of the month, time difference in minutes from UTC, hour of the day, minutes of the hour, seconds of the minute, and milliseconds of the second in successive values of the array.

Programs making use of this intrinsic might not be Year 10000 (Y10K) compliant. For example, the date might appear, to such programs, to wrap around (change from a larger value to a smaller one) as of the Year 10000.

On systems where a millisecond timer isn't available, the millisecond value is returned as zero.

DbesJ0 Intrinsic

DbesJ0(X)

DbesJ0: REAL(KIND=2) function.

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

Intrinsic groups: unix.

Description:

Archaic form of BESJ0() that is specific to one type for X. See section BesJ0 Intrinsic.

DbesJ1 Intrinsic

DbesJ1(X)

DbesJ1: REAL(KIND=2) function.

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

Intrinsic groups: unix.

Description:

Archaic form of BESJ1() that is specific to one type for X. See section BesJ1 Intrinsic.

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.

Description:

Archaic form of BESJN() that is specific to one type for X. See section BesJN Intrinsic.

DbesY0 Intrinsic

DbesY0(X)

DbesY0: REAL(KIND=2) function.

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

Intrinsic groups: unix.

Description:

Archaic form of BESY0() that is specific to one type for X. See section BesY0 Intrinsic.

DbesY1 Intrinsic

DbesY1(X)

DbesY1: REAL(KIND=2) function.

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

Intrinsic groups: unix.

Description:

Archaic form of BESY1() that is specific to one type for X. See section BesY1 Intrinsic.

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.

Description:

Archaic form of BESYN() that is specific to one type for X. See section BesYN Intrinsic.

Dble Intrinsic

Dble(A)

Dble: REAL(KIND=2) function.

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

Intrinsic groups: (standard FORTRAN 77).

Description:

Returns A converted to double precision (REAL(KIND=2)). If A is COMPLEX, the real part of A is used for the conversion and the imaginary part disregarded.

See section Sngl Intrinsic, for the function that converts to single precision.

See section Int Intrinsic, for the function that converts to INTEGER.

See section Complex Intrinsic, for the function that converts to COMPLEX.

DCos Intrinsic

DCos(X)

DCos: REAL(KIND=2) function.

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

Intrinsic groups: (standard FORTRAN 77).

Description:

Archaic form of COS() that is specific to one type for X. See section Cos Intrinsic.

DCosH Intrinsic

DCosH(X)

DCosH: REAL(KIND=2) function.

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

Intrinsic groups: (standard FORTRAN 77).

Description:

Archaic form of COSH() that is specific to one type for X. See section CosH Intrinsic.

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).

Description:

Archaic form of DIM() that is specific to one type for X and Y. See section DiM Intrinsic.

DErF Intrinsic

DErF(X)

DErF: REAL(KIND=2) function.

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

Intrinsic groups: unix.

Description:

Archaic form of ERF() that is specific to one type for X. See section ErF Intrinsic.

DErFC Intrinsic

DErFC(X)

DErFC: REAL(KIND=2) function.

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

Intrinsic groups: unix.

Description:

Archaic form of ERFC() that is specific to one type for X. See section ErFC Intrinsic.

DExp Intrinsic

DExp(X)

DExp: REAL(KIND=2) function.

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

Intrinsic groups: (standard FORTRAN 77).

Description:

Archaic form of EXP() that is specific to one type for X. See section Exp Intrinsic.

Digits Intrinsic

This intrinsic is not yet implemented. The name is, however, reserved as an intrinsic. Use `EXTERNAL Digits' to use this name for an external procedure.

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).

Description:

Returns `X-Y' if X is greater than Y; otherwise returns zero.

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.

Dot_Product Intrinsic

This intrinsic is not yet implemented. The name is, however, reserved as an intrinsic. Use `EXTERNAL Dot_Product' to use this name for an external procedure.

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).

Description:

Returns `DBLE(X)*DBLE(Y)'.

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).

Description:

Archaic form of SIGN() that is specific to one type for A and B. See section Sign Intrinsic.

DSin Intrinsic

DSin(X)

DSin: REAL(KIND=2) function.

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

Intrinsic groups: (standard FORTRAN 77).

Description:

Archaic form of SIN() that is specific to one type for X. See section Sin Intrinsic.

DSinH Intrinsic

DSinH(X)

DSinH: REAL(KIND=2) function.

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

Intrinsic groups: (standard FORTRAN 77).

Description:

Archaic form of SINH() that is specific to one type for X. See section SinH Intrinsic.

DSqRt Intrinsic

DSqRt(X)

DSqRt: REAL(KIND=2) function.

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

Intrinsic groups: (standard FORTRAN 77).

Description:

Archaic form of SQRT() that is specific to one type for X. See section SqRt Intrinsic.

DTan Intrinsic

DTan(X)

DTan: REAL(KIND=2) function.

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

Intrinsic groups: (standard FORTRAN 77).

Description:

Archaic form of TAN() that is specific to one type for X. See section Tan Intrinsic.

DTanH Intrinsic

DTanH(X)

DTanH: REAL(KIND=2) function.

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

Intrinsic groups: (standard FORTRAN 77).

Description:

Archaic form of TANH() that is specific to one type for X. See section TanH Intrinsic.

DTime Intrinsic (subroutine)

CALL DTime(TArray, Result)

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

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

Intrinsic groups: unix.

Description:

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

Subsequent invocations of `DTIME()' set values based on accumulations since the previous invocation.

On some systems, the underlying timings are represented using types with sufficiently small limits that overflows (wraparounds) are possible, such as 32-bit types. Therefore, the values returned by this intrinsic might be, or become, negative, or numerically less than previous values, during a single run of the compiled program.

Some non-GNU implementations of Fortran provide this intrinsic as only a function, not as a subroutine.

For information on other intrinsics with the same name: See section DTime Intrinsic (function).

EOShift Intrinsic

This intrinsic is not yet implemented. The name is, however, reserved as an intrinsic. Use `EXTERNAL EOShift' to use this name for an external procedure.

Epsilon Intrinsic

This intrinsic is not yet implemented. The name is, however, reserved as an intrinsic. Use `EXTERNAL Epsilon' to use this name for an external procedure.

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 might be more accurate than explicitly evaluating that formulae would give). See erfc(3m), which provides the implementation.

ETime Intrinsic (subroutine)

CALL ETime(TArray, Result)

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

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

Intrinsic groups: unix.

Description:

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

On some systems, the underlying timings are represented using types with sufficiently small limits that overflows (wraparounds) are possible, such as 32-bit types. Therefore, the values returned by this intrinsic might be, or become, negative, or numerically less than previous values, during a single run of the compiled program.

Some non-GNU implementations of Fortran provide this intrinsic as only a function, not as a subroutine.

For information on other intrinsics with the same name: See section ETime Intrinsic (function).

ETime Intrinsic (function)

ETime(TArray)

ETime: REAL(KIND=1) function.

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

Intrinsic groups: unix.

Description:

Return the number of seconds of runtime since the start of the process's 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)'.

On some systems, the underlying timings are represented using types with sufficiently small limits that overflows (wraparounds) are possible, such as 32-bit types. Therefore, the values returned by this intrinsic might be, or become, negative, or numerically less than previous values, during a single run of the compiled program.

For information on other intrinsics with the same name: See section ETime Intrinsic (subroutine).

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).

Description:

Returns `e**X', where e is approximately 2.7182818.

See section Log Intrinsic, for the inverse of this function.

Exponent Intrinsic

This intrinsic is not yet implemented. The name is, however, reserved as an intrinsic. Use `EXTERNAL Exponent' to use this name for an external procedure.

FDate Intrinsic (subroutine)

CALL FDate(Date)

Date: CHARACTER; scalar; INTENT(OUT).

Intrinsic groups: unix.

Description:

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

Equivalent to:

CALL CTIME(Date, TIME8())

Programs making use of this intrinsic might not be Year 10000 (Y10K) compliant. For example, the date might appear, to such programs, to wrap around (change from a larger value to a smaller one) as of the Year 10000.

See section CTime Intrinsic (subroutine).

Some non-GNU implementations of Fortran provide this intrinsic as only a function, not as a subroutine.

For information on other intrinsics with the same name: See section FDate Intrinsic (function).

FDate Intrinsic (function)

FDate()

FDate: CHARACTER*(*) function.

Intrinsic groups: unix.

Description:

Returns the current date (using the same format as CTIME()).

Equivalent to:

CTIME(TIME8())

Programs making use of this intrinsic might not be Year 10000 (Y10K) compliant. For example, the date might appear, to such programs, to wrap around (change from a larger value to a smaller one) as of the Year 10000.

See section CTime Intrinsic (function).

For information on other intrinsics with the same name: See section FDate Intrinsic (subroutine).

FGet Intrinsic (subroutine)

CALL FGet(C, Status)

C: CHARACTER; scalar; INTENT(OUT).

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

Intrinsic groups: unix.

Description:

Reads a single character into C in stream mode from unit 5 (by-passing normal formatted output) using getc(3). Returns in Status 0 on success, -1 on end-of-file, and the error code from ferror(3) otherwise.

Stream I/O should not be mixed with normal record-oriented (formatted or unformatted) I/O on the same unit; the results are unpredictable.

For information on other intrinsics with the same name: See section FGet Intrinsic (function).

FGetC Intrinsic (subroutine)

CALL FGetC(Unit, C, Status)

Unit: INTEGER; scalar; INTENT(IN).

C: CHARACTER; scalar; INTENT(OUT).

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

Intrinsic groups: unix.

Description:

Reads a single character into C in stream mode from unit Unit (by-passing normal formatted output) using getc(3). Returns in Status 0 on success, -1 on end-of-file, and the error code from ferror(3) otherwise.

Stream I/O should not be mixed with normal record-oriented (formatted or unformatted) I/O on the same unit; the results are unpredictable.

For information on other intrinsics with the same name: See section FGetC Intrinsic (function).

Float Intrinsic

Float(A)

Float: REAL(KIND=1) function.

A: INTEGER; scalar; INTENT(IN).

Intrinsic groups: (standard FORTRAN 77).

Description:

Archaic form of REAL() that is specific to one type for A. See section Real Intrinsic.

Floor Intrinsic

This intrinsic is not yet implemented. The name is, however, reserved as an intrinsic. Use `EXTERNAL Floor' to use this name for an external procedure.

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.

Some non-GNU implementations of Fortran provide this intrinsic as a library procedure that might or might not support the (optional) Unit argument.

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.

FPut Intrinsic (subroutine)

CALL FPut(C, Status)

C: CHARACTER; scalar; INTENT(IN).

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

Intrinsic groups: unix.

Description:

Writes the single character C in stream mode to unit 6 (by-passing normal formatted output) using putc(3). Returns in Status 0 on success, the error code from ferror(3) otherwise.

Stream I/O should not be mixed with normal record-oriented (formatted or unformatted) I/O on the same unit; the results are unpredictable.

For information on other intrinsics with the same name: See section FPut Intrinsic (function).

FPutC Intrinsic (subroutine)

CALL FPutC(Unit, C, Status)

Unit: INTEGER; scalar; INTENT(IN).

C: CHARACTER; scalar; INTENT(IN).

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

Intrinsic groups: unix.

Description:

Writes the single character Unit in stream mode to unit 6 (by-passing normal formatted output) using putc(3). Returns in C 0 on success, the error code from ferror(3) otherwise.

Stream I/O should not be mixed with normal record-oriented (formatted or unformatted) I/O on the same unit; the results are unpredictable.

For information on other intrinsics with the same name: See section FPutC Intrinsic (function).

Fraction Intrinsic

This intrinsic is not yet implemented. The name is, however, reserved as an intrinsic. Use `EXTERNAL Fraction' to use this name for an external procedure.

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 Whence=0; relative to the current offset if Whence=1; relative to the end of the file if Whence=2. It branches to label ErrLab if Unit is not open or if the call otherwise fails.

FStat Intrinsic (subroutine)

CALL FStat(Unit, SArray, Status)

Unit: INTEGER; scalar; INTENT(IN).

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

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

Intrinsic groups: unix.

Description:

Obtains data about the 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. Device ID
  2. Inode number
  3. File mode
  4. Number of links
  5. Owner's uid
  6. Owner's gid
  7. ID of device containing directory entry for file (0 if not available)
  8. File size (bytes)
  9. Last access time
  10. Last modification time
  11. Last file status change time
  12. Preferred I/O block size (-1 if not available)
  13. Number of blocks allocated (-1 if not available)

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

If the Status argument is supplied, it contains 0 on success or a non-zero error code upon return.

Some non-GNU implementations of Fortran provide this intrinsic as only a function, not as a subroutine, or do not support the (optional) Status argument.

For information on other intrinsics with the same name: See section FStat Intrinsic (function).

FStat Intrinsic (function)

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. Device ID
  2. Inode number
  3. File mode
  4. Number of links
  5. Owner's uid
  6. Owner's gid
  7. ID of device containing directory entry for file (0 if not available)
  8. File size (bytes)
  9. Last access time
  10. Last modification time
  11. Last file status change time
  12. Preferred I/O block size (-1 if not available)
  13. Number of blocks allocated (-1 if not available)

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

Returns 0 on success or a non-zero error code.

For information on other intrinsics with the same name: See section FStat Intrinsic (subroutine).

FTell Intrinsic (subroutine)

CALL FTell(Unit, Offset)

Unit: INTEGER; scalar; INTENT(IN).

Offset: INTEGER(KIND=1); scalar; INTENT(OUT).

Intrinsic groups: unix.

Description:

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

Some non-GNU implementations of Fortran provide this intrinsic as only a function, not as a subroutine.

For information on other intrinsics with the same name: See section FTell Intrinsic (function).

FTell Intrinsic (function)

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).

For information on other intrinsics with the same name: See section FTell Intrinsic (subroutine).

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 (subroutine)

CALL GetCWD(Name, Status)

Name: CHARACTER; scalar; INTENT(OUT).

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

Intrinsic groups: unix.

Description:

Places the current working directory in Name. If the Status argument is supplied, it contains 0 success or a non-zero error code upon return (ENOSYS if the system does not provide getcwd(3) or getwd(3)).

Some non-GNU implementations of Fortran provide this intrinsic as only a function, not as a subroutine, or do not support the (optional) Status argument.

For information on other intrinsics with the same name: See section GetCWD Intrinsic (function).

GetCWD Intrinsic (function)

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 a non-zero error code (ENOSYS if the system does not provide getcwd(3) or getwd(3)).

For information on other intrinsics with the same name: See section GetCWD Intrinsic (subroutine).

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. A null character (`CHAR(0)') marks the end of the name in Name---otherwise, trailing blanks in Name are ignored.

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.

Caution: On some systems, the getlogin(3) function, which this intrinsic calls at run time, is either not implemented or returns a null pointer. In the latter case, this intrinsic returns blanks 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. Years since 1900
  7. Number of days since Sunday, range 0--6
  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 (subroutine)

CALL HostNm(Name, Status)

Name: CHARACTER; scalar; INTENT(OUT).

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

Intrinsic groups: unix.

Description:

Fills Name with the system's host name returned by gethostname(2). If the Status argument is supplied, it contains 0 on success or a non-zero error code upon return (ENOSYS if the system does not provide gethostname(2)).

Some non-GNU implementations of Fortran provide this intrinsic as only a function, not as a subroutine, or do not support the (optional) Status argument.

On some systems (specifically SCO) it might be necessary to link the "socket" library if you call this routine. Typically this means adding `-lg2c -lsocket -lm' to the g77 command line when linking the program.

For information on other intrinsics with the same name: See section HostNm Intrinsic (function).

HostNm Intrinsic (function)

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 a non-zero error code (ENOSYS if the system does not provide gethostname(2)).

On some systems (specifically SCO) it might be necessary to link the "socket" library if you call this routine. Typically this means adding `-lg2c -lsocket -lm' to the g77 command line when linking the program.

For information on other intrinsics with the same name: See section HostNm Intrinsic (subroutine).

Huge Intrinsic

This intrinsic is not yet implemented. The name is, however, reserved as an intrinsic. Use `EXTERNAL Huge' to use this name for an external procedure.

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 of this 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.

Description:

Returns the value of I with bit Pos cleared (set to zero). See section BTest Intrinsic, for information on bit positions.

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.

Description:

Extracts a subfield of length Len from I, starting from bit position Pos and extending left for Len bits. The result is right-justified and the remaining bits are zeroed. The value of `Pos+Len' must be less than or equal to the value `BIT_SIZE(I)'. See section Bit_Size Intrinsic.

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.

Description:

Returns the value of I with bit Pos set (to one). See section BTest Intrinsic, for information on bit positions.

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.

Note that no intrinsic exists to convert a printable character string to a numerical value. For example, there is no intrinsic that, given the CHARACTER value `'154'', returns an INTEGER or REAL value with the value `154'.

Instead, you can use internal-file I/O to do this kind of conversion. For example:

INTEGER VALUE
CHARACTER*10 STRING
STRING = '154'
READ (STRING, '(I10)'), VALUE
PRINT *, VALUE
END

The above program, when run, prints:

 154

See section Char Intrinsic, for the inverse of the ICHAR function.

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

IDate Intrinsic (UNIX)

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.

Programs making use of this intrinsic might not be Year 10000 (Y10K) compliant. For example, the date might appear, to such programs, to wrap around (change from a larger value to a smaller one) as of the Year 10000.

For information on other intrinsics with the same name: See section IDate Intrinsic (VXT).

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).

Description:

Archaic form of DIM() that is specific to one type for X and Y. See section DiM Intrinsic.

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: REAL(KIND=1); 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.

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).

Description:

Returns the position of the start of the first occurrence of string Substring as a substring in String, counting from one. If Substring doesn't occur in String, zero is returned.

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, and its imaginary part is disregarded.

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.

Int2 Intrinsic

Int2(A)

Int2: INTEGER(KIND=6) function.

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

Intrinsic groups: gnu.

Description:

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

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

See section Int Intrinsic.

The precise meaning of this intrinsic might change in a future version of the GNU Fortran language, as more is learned about how it is used.

Int8 Intrinsic

Int8(A)

Int8: INTEGER(KIND=2) function.

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

Intrinsic groups: gnu.

Description:

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

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

See section Int Intrinsic.

The precise meaning of this intrinsic might change in a future version of the GNU Fortran language, as more is learned about how it is used.

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.

Description:

All bits representing I are shifted Shift places. `Shift.GT.0' indicates a left shift, `Shift.EQ.0' indicates no shift and `Shift.LT.0' indicates a right shift. If the absolute value of the shift count is greater than `BIT_SIZE(I)', the result is undefined. Bits shifted out from the left end or the right end are lost. Zeros are shifted in from the opposite end.

See section IShftC Intrinsic, for the circular-shift equivalent.

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.

Description:

The rightmost Size bits of the argument I are shifted circularly Shift places, i.e. the bits shifted out of one end are shifted into the opposite end. No bits are lost. The unshifted bits of the result are the same as the unshifted bits of I. The absolute value of the argument Shift must be less than or equal to Size. The value of Size must be greater than or equal to one and less than or equal to `BIT_SIZE(I)'.

See section IShft Intrinsic, for the logical shift equivalent.

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).

Description:

Archaic form of SIGN() that is specific to one type for A and B. See section Sign Intrinsic.

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 (subroutine)

CALL Kill(Pid, Signal, Status)

Pid: INTEGER; scalar; INTENT(IN).

Signal: INTEGER; scalar; INTENT(IN).

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

Intrinsic groups: unix.

Description:

Sends the signal specified by Signal to the process Pid. If the Status argument is supplied, it contains 0 on success or a non-zero error code upon return. See kill(2).

Some non-GNU implementations of Fortran provide this intrinsic as only a function, not as a subroutine, or do not support the (optional) Status argument.

For information on other intrinsics with the same name: See section Kill Intrinsic (function).

Kind Intrinsic

This intrinsic is not yet implemented. The name is, however, reserved as an intrinsic. Use `EXTERNAL Kind' to use this name for an external procedure.

LBound Intrinsic

This intrinsic is not yet implemented. The name is, however, reserved as an intrinsic. Use `EXTERNAL LBound' to use this name for an external procedure.

Len Intrinsic

Len(String)

Len: INTEGER(KIND=1) function.

String: CHARACTER; scalar.

Intrinsic groups: (standard FORTRAN 77).

Description:

Returns the length of String.

If String is an array, the length of an element of String is returned.

Note that String need not be defined when this intrinsic is invoked, since only the length, not the content, of String is needed.

See section Bit_Size Intrinsic, for the function that determines the size of its argument in bits.

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).

Description:

Returns `.TRUE.' if `String_A.GE.String_B', `.FALSE.' otherwise. String_A and String_B are interpreted as containing ASCII character codes. If either value contains a character not in the ASCII character set, the result is processor dependent.

If the String_A and String_B are not the same length, the shorter is compared as if spaces were appended to it to form a value that has the same length as the longer.

The lexical comparison intrinsics LGe, LGt, LLe, and LLt differ from the corresponding intrinsic operators .GE., .GT., .LE., .LT.. Because the ASCII collating sequence is assumed, the following expressions always return `.TRUE.':

LGE ('0', ' ')
LGE ('A', '0')
LGE ('a', 'A')

The following related expressions do not always return `.TRUE.', as they are not necessarily evaluated assuming the arguments use ASCII encoding:

'0' .GE. ' '
'A' .GE. '0'
'a' .GE. 'A'

The same difference exists between LGt and .GT.; between LLe and .LE.; and between LLt and .LT..

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).

Description:

Returns `.TRUE.' if `String_A.GT.String_B', `.FALSE.' otherwise. String_A and String_B are interpreted as containing ASCII character codes. If either value contains a character not in the ASCII character set, the result is processor dependent.

If the String_A and String_B are not the same length, the shorter is compared as if spaces were appended to it to form a value that has the same length as the longer.

See section LGe Intrinsic, for information on the distinction between the LGT intrinsic and the .GT. operator.

Link Intrinsic (subroutine)

CALL Link(Path1, Path2, Status)

Path1: CHARACTER; scalar; INTENT(IN).

Path2: CHARACTER; scalar; INTENT(IN).

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

Intrinsic groups: unix.

Description:

Makes a (hard) link from file Path1 to Path2. A null character (`CHAR(0)') marks the end of the names in Path1 and Path2---otherwise, trailing blanks in Path1 and Path2 are ignored. If the Status argument is supplied, it contains 0 on success or a non-zero error code upon return. See link(2).

Some non-GNU implementations of Fortran provide this intrinsic as only a function, not as a subroutine, or do not support the (optional) Status argument.

For information on other intrinsics with the same name: See section Link Intrinsic (function).

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).

Description:

Returns `.TRUE.' if `String_A.LE.String_B', `.FALSE.' otherwise. String_A and String_B are interpreted as containing ASCII character codes. If either value contains a character not in the ASCII character set, the result is processor dependent.

If the String_A and String_B are not the same length, the shorter is compared as if spaces were appended to it to form a value that has the same length as the longer.

See section LGe Intrinsic, for information on the distinction between the LLE intrinsic and the .LE. operator.

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).

Description:

Returns `.TRUE.' if `String_A.LT.String_B', `.FALSE.' otherwise. String_A and String_B are interpreted as containing ASCII character codes. If either value contains a character not in the ASCII character set, the result is processor dependent.

If the String_A and String_B are not the same length, the shorter is compared as if spaces were appended to it to form a value that has the same length as the longer.

See section LGe Intrinsic, for information on the distinction between the LLT intrinsic and the .LT. operator.

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=7) 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 of this function.

See section Log10 Intrinsic, for the `common' (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 common logarithm (base 10) of X, which must be greater than zero.

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

See section Log Intrinsic, for the natural logarithm function.

Logical Intrinsic

This intrinsic is not yet implemented. The name is, however, reserved as an intrinsic. Use `EXTERNAL Logical' to use this name for an external procedure.

Long Intrinsic

Long(A)

Long: INTEGER(KIND=1) function.

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

Intrinsic groups: unix.

Description:

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

The precise meaning of this intrinsic might change in a future version of the GNU Fortran language, as more is learned about how it is used.

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.

Description:

Returns I shifted to the left Shift bits.

Although similar to the expression `I*(2**Shift)', there are important differences. For example, the sign of the result is not necessarily the same as the sign of I.

Currently this intrinsic is defined assuming the underlying representation of I is as a two's-complement integer. It is unclear at this point whether that definition will apply when a different representation is involved.

See section LShift Intrinsic, for the inverse of this function.

See section IShft Intrinsic, for information on a more widely available left-shifting intrinsic that is also more precisely defined.

LStat Intrinsic (subroutine)

CALL LStat(File, SArray, Status)

File: CHARACTER; scalar; INTENT(IN).

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

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

Intrinsic groups: unix.

Description:

Obtains data about the given file File and places them in the array SArray. A null character (`CHAR(0)') marks the end of the name in File---otherwise, trailing blanks in File are ignored. 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. Device ID
  2. Inode number
  3. File mode
  4. Number of links
  5. Owner's uid
  6. Owner's gid
  7. ID of device containing directory entry for file (0 if not available)
  8. File size (bytes)
  9. Last access time
  10. Last modification time
  11. Last file status change time
  12. Preferred I/O block size (-1 if not available)
  13. Number of blocks allocated (-1 if not available)

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

If the Status argument is supplied, it contains 0 on success or a non-zero error code upon return (ENOSYS if the system does not provide lstat(2)).

Some non-GNU implementations of Fortran provide this intrinsic as only a function, not as a subroutine, or do not support the (optional) Status argument.

For information on other intrinsics with the same name: See section LStat Intrinsic (function).

LStat Intrinsic (function)

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 File and places them in the array SArray. A null character (`CHAR(0)') marks the end of the name in File---otherwise, trailing blanks in File are ignored. 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. Device ID
  2. Inode number
  3. File mode
  4. Number of links
  5. Owner's uid
  6. Owner's gid
  7. ID of device containing directory entry for file (0 if not available)
  8. File size (bytes)
  9. Last access time
  10. Last modification time
  11. Last file status change time
  12. Preferred I/O block size (-1 if not available)
  13. Number of blocks allocated (-1 if not available)

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

Returns 0 on success or a non-zero error code (ENOSYS if the system does not provide lstat(2)).

For information on other intrinsics with the same name: See section LStat Intrinsic (subroutine).

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. Years since 1900
  7. Number of days since Sunday, range 0--6
  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.

MatMul Intrinsic

This intrinsic is not yet implemented. The name is, however, reserved as an intrinsic. Use `EXTERNAL MatMul' to use this name for an external procedure.

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.

MaxExponent Intrinsic

This intrinsic is not yet implemented. The name is, however, reserved as an intrinsic. Use `EXTERNAL MaxExponent' to use this name for an external procedure.

MaxLoc Intrinsic

This intrinsic is not yet implemented. The name is, however, reserved as an intrinsic. Use `EXTERNAL MaxLoc' to use this name for an external procedure.

MaxVal Intrinsic

This intrinsic is not yet implemented. The name is, however, reserved as an intrinsic. Use `EXTERNAL MaxVal' to use this name for an external procedure.

MClock Intrinsic

MClock()

MClock: INTEGER(KIND=1) function.

Intrinsic groups: unix.

Description:

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

This intrinsic is not fully portable, such as to systems with 32-bit INTEGER types but supporting times wider than 32 bits. Therefore, the values returned by this intrinsic might be, or become, negative, or numerically less than previous values, during a single run of the compiled program.

See section MClock8 Intrinsic, for information on a similar intrinsic that might be portable to more GNU Fortran implementations, though to fewer Fortran compilers.

If the system does not support clock(3), -1 is returned.

MClock8 Intrinsic

MClock8()

MClock8: INTEGER(KIND=2) function.

Intrinsic groups: unix.

Description:

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

Warning: this intrinsic does not increase the range of the timing values over that returned by clock(3). On a system with a 32-bit clock(3), MCLOCK8 will return a 32-bit value, even though converted to an `INTEGER(KIND=2)' value. That means overflows of the 32-bit value can still occur. Therefore, the values returned by this intrinsic might be, or become, negative, or numerically less than previous values, during a single run of the compiled program.

No Fortran implementations other than GNU Fortran are known to support this intrinsic at the time of this writing. See section MClock Intrinsic, for information on a similar intrinsic that might be portable to more Fortran compilers, though to fewer GNU Fortran implementations.

If the system does not support clock(3), -1 is returned.

Merge Intrinsic

This intrinsic is not yet implemented. The name is, however, reserved as an intrinsic. Use `EXTERNAL Merge' to use this name for an external procedure.

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.

MinExponent Intrinsic

This intrinsic is not yet implemented. The name is, however, reserved as an intrinsic. Use `EXTERNAL MinExponent' to use this name for an external procedure.

MinLoc Intrinsic

This intrinsic is not yet implemented. The name is, however, reserved as an intrinsic. Use `EXTERNAL MinLoc' to use this name for an external procedure.

MinVal Intrinsic

This intrinsic is not yet implemented. The name is, however, reserved as an intrinsic. Use `EXTERNAL MinVal' to use this name for an external procedure.

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.

Modulo Intrinsic

This intrinsic is not yet implemented. The name is, however, reserved as an intrinsic. Use `EXTERNAL Modulo' to use this name for an external procedure.

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.

Description:

Moves Len bits from positions FromPos through `FromPos+Len-1' of From to positions ToPos through `FromPos+Len-1' of TO. The portion of argument TO not affected by the movement of bits is unchanged. Arguments From and TO are permitted to be the same numeric storage unit. The values of `FromPos+Len' and `ToPos+Len' must be less than or equal to `BIT_SIZE(From)'.

Nearest Intrinsic

This intrinsic is not yet implemented. The name is, however, reserved as an intrinsic. Use `EXTERNAL Nearest' to use this name for an external procedure.

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.

Pack Intrinsic

This intrinsic is not yet implemented. The name is, however, reserved as an intrinsic. Use `EXTERNAL Pack' to use this name for an external procedure.

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).

Precision Intrinsic

This intrinsic is not yet implemented. The name is, however, reserved as an intrinsic. Use `EXTERNAL Precision' to use this name for an external procedure.

Present Intrinsic

This intrinsic is not yet implemented. The name is, however, reserved as an intrinsic. Use `EXTERNAL Present' to use this name for an external procedure.

Product Intrinsic

This intrinsic is not yet implemented. The name is, however, reserved as an intrinsic. Use `EXTERNAL Product' to use this name for an external procedure.

Radix Intrinsic

This intrinsic is not yet implemented. The name is, however, reserved as an intrinsic. Use `EXTERNAL Radix' to use this name for an external procedure.

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.

Random_Number Intrinsic

This intrinsic is not yet implemented. The name is, however, reserved as an intrinsic. Use `EXTERNAL Random_Number' to use this name for an external procedure.

Random_Seed Intrinsic

This intrinsic is not yet implemented. The name is, however, reserved as an intrinsic. Use `EXTERNAL Random_Seed' to use this name for an external procedure.

Range Intrinsic

This intrinsic is not yet implemented. The name is, however, reserved as an intrinsic. Use `EXTERNAL Range' to use this name for an external procedure.

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 RealPart Intrinsic, for information on a GNU Fortran intrinsic that extracts the real part of an arbitrary COMPLEX value.

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 (subroutine)

CALL Rename(Path1, Path2, Status)

Path1: CHARACTER; scalar; INTENT(IN).

Path2: CHARACTER; scalar; INTENT(IN).

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

Intrinsic groups: unix.

Description:

Renames the file Path1 to Path2. A null character (`CHAR(0)') marks the end of the names in Path1 and Path2---otherwise, trailing blanks in Path1 and Path2 are ignored. See rename(2). If the Status argument is supplied, it contains 0 on success or a non-zero error code upon return.

Some non-GNU implementations of Fortran provide this intrinsic as only a function, not as a subroutine, or do not support the (optional) Status argument.

For information on other intrinsics with the same name: See section Rename Intrinsic (function).

Repeat Intrinsic

This intrinsic is not yet implemented. The name is, however, reserved as an intrinsic. Use `EXTERNAL Repeat' to use this name for an external procedure.

Reshape Intrinsic

This intrinsic is not yet implemented. The name is, however, reserved as an intrinsic. Use `EXTERNAL Reshape' to use this name for an external procedure.

RRSpacing Intrinsic

This intrinsic is not yet implemented. The name is, however, reserved as an intrinsic. Use `EXTERNAL RRSpacing' to use this name for an external procedure.

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.

Description:

Returns I shifted to the right Shift bits.

Although similar to the expression `I/(2**Shift)', there are important differences. For example, the sign of the result is undefined.

Currently this intrinsic is defined assuming the underlying representation of I is as a two's-complement integer. It is unclear at this point whether that definition will apply when a different representation is involved.

See section RShift Intrinsic, for the inverse of this function.

See section IShft Intrinsic, for information on a more widely available right-shifting intrinsic that is also more precisely defined.

Scale Intrinsic

This intrinsic is not yet implemented. The name is, however, reserved as an intrinsic. Use `EXTERNAL Scale' to use this name for an external procedure.

Scan Intrinsic

This intrinsic is not yet implemented. The name is, however, reserved as an intrinsic. Use `EXTERNAL Scan' to use this name for an external procedure.

Second Intrinsic (function)

Second()

Second: REAL(KIND=1) function.

Intrinsic groups: unix.

Description:

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

On some systems, the underlying timings are represented using types with sufficiently small limits that overflows (wraparounds) are possible, such as 32-bit types. Therefore, the values returned by this intrinsic might be, or become, negative, or numerically less than previous values, during a single run of the compiled program.

For information on other intrinsics with the same name: See section Second Intrinsic (subroutine).

Second Intrinsic (subroutine)

CALL Second(Seconds)

Seconds: REAL; scalar; INTENT(OUT).

Intrinsic groups: unix.

Description:

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

On some systems, the underlying timings are represented using types with sufficiently small limits that overflows (wraparounds) are possible, such as 32-bit types. Therefore, the values returned by this intrinsic might be, or become, negative, or numerically less than previous values, during a single run of the compiled program.

This routine is known from Cray Fortran. See section CPU_Time Intrinsic, for a standard equivalent.

For information on other intrinsics with the same name: See section Second Intrinsic (function).

Selected_Int_Kind Intrinsic

This intrinsic is not yet implemented. The name is, however, reserved as an intrinsic. Use `EXTERNAL Selected_Int_Kind' to use this name for an external procedure.

Selected_Real_Kind Intrinsic

This intrinsic is not yet implemented. The name is, however, reserved as an intrinsic. Use `EXTERNAL Selected_Real_Kind' to use this name for an external procedure.

Set_Exponent Intrinsic

This intrinsic is not yet implemented. The name is, however, reserved as an intrinsic. Use `EXTERNAL Set_Exponent' to use this name for an external procedure.

Shape Intrinsic

This intrinsic is not yet implemented. The name is, however, reserved as an intrinsic. Use `EXTERNAL Shape' to use this name for an external procedure.

Short Intrinsic

Short(A)

Short: INTEGER(KIND=6) function.

A: INTEGER; scalar; INTENT(IN).

Intrinsic groups: unix.

Description:

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

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

See section Int Intrinsic.

The precise meaning of this intrinsic might change in a future version of the GNU Fortran language, as more is learned about how it is used.

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).

Description:

Returns `ABS(A)*s', where s is +1 if `B.GE.0', -1 otherwise.

See section Abs Intrinsic, for the function that returns the magnitude of a value.

Signal Intrinsic (subroutine)

CALL Signal(Number, Handler, Status)

Number: INTEGER; scalar; INTENT(IN).

Handler: Signal handler (INTEGER FUNCTION or SUBROUTINE) or dummy/global INTEGER(KIND=1) scalar.

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

Intrinsic groups: unix.

Description:

If Handler is a an EXTERNAL routine, arranges for it to be invoked with a single integer argument (of system-dependent length) when signal Number occurs. If Handler is an integer, it can be used to turn off handling of signal Number or revert to its default action. See signal(2).

Note that Handler will be called using C conventions, so the value of its argument in Fortran terms Fortran terms is obtained by applying %LOC() (or LOC()) to it.

The value returned by signal(2) is written to Status, if that argument is supplied. Otherwise the return value is ignored.

Some non-GNU implementations of Fortran provide this intrinsic as only a function, not as a subroutine, or do not support the (optional) Status argument.

Warning: Use of the libf2c run-time library function `signal_' directly (such as via `EXTERNAL SIGNAL') requires use of the %VAL() construct to pass an INTEGER value (such as `SIG_IGN' or `SIG_DFL') for the Handler argument.

However, while `CALL SIGNAL(signum, %VAL(SIG_IGN))' works when `SIGNAL' is treated as an external procedure (and resolves, at link time, to libf2c's `signal_' routine), this construct is not valid when `SIGNAL' is recognized as the intrinsic of that name.

Therefore, for maximum portability and reliability, code such references to the `SIGNAL' facility as follows:

INTRINSIC SIGNAL
...
CALL SIGNAL(signum, SIG_IGN)

g77 will compile such a call correctly, while other compilers will generally either do so as well or reject the `INTRINSIC SIGNAL' statement via a diagnostic, allowing you to take appropriate action.

For information on other intrinsics with the same name: See section Signal Intrinsic (function).

Sin Intrinsic

Sin(X)

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

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

Intrinsic groups: (standard FORTRAN 77).

Description:

Returns the sine of X, an angle measured in radians.

See section ASin Intrinsic, for the inverse of this function.

SinH Intrinsic

SinH(X)

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

X: REAL; scalar; INTENT(IN).

Intrinsic groups: (standard FORTRAN 77).

Description:

Returns the hyperbolic sine of X.

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).

Description:

Archaic form of REAL() that is specific to one type for A. See section Real Intrinsic.

Spacing Intrinsic

This intrinsic is not yet implemented. The name is, however, reserved as an intrinsic. Use `EXTERNAL Spacing' to use this name for an external procedure.

Spread Intrinsic

This intrinsic is not yet implemented. The name is, however, reserved as an intrinsic. Use `EXTERNAL Spread' to use this name for an external procedure.

SqRt Intrinsic

SqRt(X)

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

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

Intrinsic groups: (standard FORTRAN 77).

Description:

Returns the square root of X, which must not be negative.

To calculate and represent the square root of a negative number, complex arithmetic must be used. For example, `SQRT(COMPLEX(X))'.

The inverse of this function is `SQRT(X) * SQRT(X)'.

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 (subroutine)

CALL Stat(File, SArray, Status)

File: CHARACTER; scalar; INTENT(IN).

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

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

Intrinsic groups: unix.

Description:

Obtains data about the given file File and places them in the array SArray. A null character (`CHAR(0)') marks the end of the name in File---otherwise, trailing blanks in File are ignored. The values in this array are extracted from the stat structure as returned by fstat(2) q.v., as follows:

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

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

If the Status argument is supplied, it contains 0 on success or a non-zero error code upon return.

Some non-GNU implementations of Fortran provide this intrinsic as only a function, not as a subroutine, or do not support the (optional) Status argument.

For information on other intrinsics with the same name: See section Stat Intrinsic (function).

Stat Intrinsic (function)

Stat(File, SArray)

Stat: INTEGER(KIND=1) function.

File: CHARACTER; scalar; INTENT(IN).

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

Intrinsic groups: unix.

Description:

Obtains data about the given file File and places them in the array SArray. A null character (`CHAR(0)') marks the end of the name in File---otherwise, trailing blanks in File are ignored. The values in this array are extracted from the stat structure as returned by fstat(2) q.v., as follows:

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

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

Returns 0 on success or a non-zero error code.

For information on other intrinsics with the same name: See section Stat Intrinsic (subroutine).

Sum Intrinsic

This intrinsic is not yet implemented. The name is, however, reserved as an intrinsic. Use `EXTERNAL Sum' to use this name for an external procedure.

SymLnk Intrinsic (subroutine)

CALL SymLnk(Path1, Path2, Status)

Path1: CHARACTER; scalar; INTENT(IN).

Path2: CHARACTER; scalar; INTENT(IN).

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

Intrinsic groups: unix.

Description:

Makes a symbolic link from file Path1 to Path2. A null character (`CHAR(0)') marks the end of the names in Path1 and Path2---otherwise, trailing blanks in Path1 and Path2 are ignored. If the Status argument is supplied, it contains 0 on success or a non-zero error code upon return (ENOSYS if the system does not provide symlink(2)).

Some non-GNU implementations of Fortran provide this intrinsic as only a function, not as a subroutine, or do not support the (optional) Status argument.

For information on other intrinsics with the same name: See section SymLnk Intrinsic (function).

System Intrinsic (subroutine)

CALL System(Command, Status)

Command: CHARACTER; scalar; INTENT(IN).

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

Intrinsic groups: unix.

Description:

Passes the command Command to a shell (see system(3)). If argument Status is present, it contains the value returned by system(3), presumably 0 if the shell command succeeded. Note that which shell is used to invoke the command is system-dependent and environment-dependent.

Some non-GNU implementations of Fortran provide this intrinsic as only a function, not as a subroutine, or do not support the (optional) Status argument.

For information on other intrinsics with the same name: See section System Intrinsic (function).

System_Clock Intrinsic

CALL System_Clock(Count, Rate, Max)

Count: INTEGER(KIND=1); scalar; INTENT(OUT).

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

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

Intrinsic groups: f90.

Description:

Returns in Count the current value of the system clock; this is the value returned by the UNIX function times(2) in this implementation, but isn't in general. Rate is the number of clock ticks per second and Max is the maximum value this can take, which isn't very useful in this implementation since it's just the maximum C unsigned int value.

On some systems, the underlying timings are represented using types with sufficiently small limits that overflows (wraparounds) are possible, such as 32-bit types. Therefore, the values returned by this intrinsic might be, or become, negative, or numerically less than previous values, during a single run of the compiled program.

Tan Intrinsic

Tan(X)

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

X: REAL; scalar; INTENT(IN).

Intrinsic groups: (standard FORTRAN 77).

Description:

Returns the tangent of X, an angle measured in radians.

See section ATan Intrinsic, for the inverse of this function.

TanH Intrinsic

TanH(X)

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

X: REAL; scalar; INTENT(IN).

Intrinsic groups: (standard FORTRAN 77).

Description:

Returns the hyperbolic tangent of X.

Time Intrinsic (UNIX)

Time()

Time: INTEGER(KIND=1) function.

Intrinsic groups: unix.

Description:

Returns the current time encoded as an integer (in the manner of the UNIX function time(3)). This value is suitable for passing to CTIME, GMTIME, and LTIME.

This intrinsic is not fully portable, such as to systems with 32-bit INTEGER types but supporting times wider than 32 bits. Therefore, the values returned by this intrinsic might be, or become, negative, or numerically less than previous values, during a single run of the compiled program.

See section Time8 Intrinsic, for information on a similar intrinsic that might be portable to more GNU Fortran implementations, though to fewer Fortran compilers.

For information on other intrinsics with the same name: See section Time Intrinsic (VXT).

Time8 Intrinsic

Time8()

Time8: INTEGER(KIND=2) function.

Intrinsic groups: unix.

Description:

Returns the current time encoded as a long integer (in the manner of the UNIX function time(3)). This value is suitable for passing to CTIME, GMTIME, and LTIME.

Warning: this intrinsic does not increase the range of the timing values over that returned by time(3). On a system with a 32-bit time(3), TIME8 will return a 32-bit value, even though converted to an `INTEGER(KIND=2)' value. That means overflows of the 32-bit value can still occur. Therefore, the values returned by this intrinsic might be, or become, negative, or numerically less than previous values, during a single run of the compiled program.

No Fortran implementations other than GNU Fortran are known to support this intrinsic at the time of this writing. See section Time Intrinsic (UNIX), for information on a similar intrinsic that might be portable to more Fortran compilers, though to fewer GNU Fortran implementations.

Tiny Intrinsic

This intrinsic is not yet implemented. The name is, however, reserved as an intrinsic. Use `EXTERNAL Tiny' to use this name for an external procedure.

Transfer Intrinsic

This intrinsic is not yet implemented. The name is, however, reserved as an intrinsic. Use `EXTERNAL Transfer' to use this name for an external procedure.

Transpose Intrinsic

This intrinsic is not yet implemented. The name is, however, reserved as an intrinsic. Use `EXTERNAL Transpose' to use this name for an external procedure.

Trim Intrinsic

This intrinsic is not yet implemented. The name is, however, reserved as an intrinsic. Use `EXTERNAL Trim' to use this name for an external procedure.

TtyNam Intrinsic (subroutine)

CALL TtyNam(Unit, Name)

Unit: INTEGER; scalar; INTENT(IN).

Name: CHARACTER; scalar; INTENT(OUT).

Intrinsic groups: unix.

Description:

Sets Name to the name of the terminal device open on logical unit Unit or to a blank string if Unit is not connected to a terminal.

Some non-GNU implementations of Fortran provide this intrinsic as only a function, not as a subroutine.

For information on other intrinsics with the same name: See section TtyNam Intrinsic (function).

TtyNam Intrinsic (function)

TtyNam(Unit)

TtyNam: CHARACTER*(*) function.

Unit: INTEGER; scalar; INTENT(IN).

Intrinsic groups: unix.

Description:

Returns the name of the terminal device open on logical unit Unit or a blank string if Unit is not connected to a terminal.

For information on other intrinsics with the same name: See section TtyNam Intrinsic (subroutine).

UBound Intrinsic

This intrinsic is not yet implemented. The name is, however, reserved as an intrinsic. Use `EXTERNAL UBound' to use this name for an external procedure.

UMask Intrinsic (subroutine)

CALL UMask(Mask, Old)

Mask: INTEGER; scalar; INTENT(IN).

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

Intrinsic groups: unix.

Description:

Sets the file creation mask to Mask and returns the old value in argument Old if it is supplied. See umask(2).

Some non-GNU implementations of Fortran provide this intrinsic as only a function, not as a subroutine.

For information on other intrinsics with the same name: See section UMask Intrinsic (function).

Unlink Intrinsic (subroutine)

CALL Unlink(File, Status)

File: CHARACTER; scalar; INTENT(IN).

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

Intrinsic groups: unix.

Description:

Unlink the file File. A null character (`CHAR(0)') marks the end of the name in File---otherwise, trailing blanks in File are ignored. If the Status argument is supplied, it contains 0 on success or a non-zero error code upon return. See unlink(2).

Some non-GNU implementations of Fortran provide this intrinsic as only a function, not as a subroutine, or do not support the (optional) Status argument.

For information on other intrinsics with the same name: See section Unlink Intrinsic (function).

Unpack Intrinsic

This intrinsic is not yet implemented. The name is, however, reserved as an intrinsic. Use `EXTERNAL Unpack' to use this name for an external procedure.

Verify Intrinsic

This intrinsic is not yet implemented. The name is, however, reserved as an intrinsic. Use `EXTERNAL Verify' to use this name for an external procedure.

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.

Description:

Archaic form of COS() that is specific to one type for X. See section Cos Intrinsic.

ZExp Intrinsic

ZExp(X)

ZExp: COMPLEX(KIND=2) function.

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

Intrinsic groups: f2c.

Description:

Archaic form of EXP() that is specific to one type for X. See section Exp Intrinsic.

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.

Description:

Archaic form of SIN() that is specific to one type for X. See section Sin Intrinsic.

ZSqRt Intrinsic

ZSqRt(X)

ZSqRt: COMPLEX(KIND=2) function.

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

Intrinsic groups: f2c.

Description:

Archaic form of SQRT() that is specific to one type for X. See section SqRt Intrinsic.

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).

I/O

A dollar sign at the end of an output format specification suppresses the newline at the end of the output.

Edit descriptors in FORMAT statements may contain compile-time INTEGER constant expressions in angle brackets, such as

10    FORMAT (I<WIDTH>)

The OPEN specifier NAME= is equivalent to FILE=.

These Fortran 90 features are supported:

Fortran 90 Features

For convenience this section collects a list (probably incomplete) of the Fortran 90 features supported by the GNU Fortran language, even if they are documented elsewhere. See section `Characters' in and Execution Sequence, for information on additional fixed source form lexical issues. Further, the free source form is supported through the `-ffree-form' option. Other Fortran 90 features can be turned on by the `-ff90' option; see section Fortran 90. For information on the Fortran 90 intrinsics available, see section Table of Intrinsic Functions.

Automatic arrays in procedures
Character assignments
In character assignments, the variable being assigned may occur on the right hand side of the assignment.
Character strings
Strings may have zero length and substrings of character constants are permitted. Character constants may be enclosed in double quotes (") as well as single quotes. See section Character Type.
Construct names
(Symbolic tags on blocks.) See section Construct Names.
CYCLE and EXIT
See section The CYCLE and EXIT Statements.
DOUBLE COMPLEX
See section DOUBLE COMPLEX Statement.
DO WHILE
See section DO WHILE.
END decoration
See section Statements.
END DO
See section END DO.
KIND
IMPLICIT NONE
INCLUDE statements
See section Including Source Text.
List-directed and namelist I/O on internal files
Binary, octal and hexadecimal constants
These are supported more generally than required by Fortran 90. See section Integer Type.
`O' and `Z' edit descriptors
NAMELIST
See section NAMELIST Statement.
OPEN specifiers
STATUS='REPLACE' is supported. The FILE= specifier may be omitted in an OPEN statement if STATUS='SCRATCH' is supplied.
FORMAT edit descriptors
The Z edit descriptor is supported.
Relational operators
The operators <, <=, ==, /=, > and >= may be used instead of .LT., .LE., .EQ., .NE., .GT. and .GE. respectively.
SELECT CASE
Not fully implemented. See section SELECT CASE on CHARACTER Type.
Specification statements
A limited subset of the Fortran 90 syntax and semantics for variable declarations is supported, including KIND. See section Kind Notation. (KIND is of limited usefulness in the absence of the KIND-related intrinsics, since these intrinsics permit writing more widely portable code.) An example of supported KIND usage is:
INTEGER (KIND=1) :: FOO=1, BAR=2
CHARACTER (LEN=3) FOO
PARAMETER and DIMENSION attributes aren't supported.


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