• Nenhum resultado encontrado

Using GNU Fortran 95

N/A
N/A
Protected

Academic year: 2023

Share "Using GNU Fortran 95"

Copied!
124
0
0

Texto

A version of the gcccommand (which can also be installed as the system's cccommand) that also understands and accepts the Fortran source code. The middle and back-end code is shared by all the compiler front-ends contained in the GNU Compiler Collection. The code generator translates the semantics of the source code into a language independent form called GENERIC.

There is a good Fortran 77 compiler in the GNU Compiler Collection that accepts some standard Fortran 90 features as extensions.

Option Summary

For information on the non-Fortran-specific aspects of the gcc command (and therefore the gfortran command), see the "GCC Command Options" section in Using the GNU Compiler Collection (GCC). All gcc and gfortran options are accepted by both gfortran and gcc (as well as all other concurrently built drivers such as g++), since adding gfortran to the gcc distribution allows gfortran options to be accepted by all relevant drivers.

Options Controlling Fortran Dialect

Options to Request or Suppress Warnings

This manual documents only one of these two forms, whichever is non-standard. If the '-fd-lines-as-comments' option is given, they are treated as comment lines. Each of these specific warning options also has a negative form beginning with '-Wno-' to turn off warnings; e.g,.

This may change in future versions of gfortran See the "Options to check for or suppress warnings" section in Using the GNU Compiler Collection (GCC), for information on more options provided by the GBE separate from gfortran, gcc and other GNU compilers.

Options for Debugging Your Program or GNU Fortran

Options for Directory Search

Set the column by which characters are ignored in typical fixed-format lines in the source file and through which spaces are assumed (as if padded to that length) at the ends of short fixed-format lines. Set the column by which characters are ignored in typical free-form lines in the source file. Specifically, it warns if the same actual argument is associated with a virtual argument with intent(in) and a virtual argument within intent(out) in a call to an explicit interface.

Warn if the user tries to use an intrinsic that is not in the default that the user chose through the -std option.

Influencing runtime behavior

Options for Code Generation Conventions

If this option is used, gfortran adds two underscores to names with underscores and one underscore to external names without underscores. Code compiled with this option is likely to be incompatible with code compiled without this option and may execute more slowly. This option is provided for interoperability with C code that was compiled with the -fshort-enums option.

See section "Options for Code Generation Conventions" in Using the GNU Compiler Collection (GCC), for information about more options offered by the GBE-shared gfortran gcc and other GNU compilers.

Environment Variables Affecting GNU Fortran

As soon as gfortran can parse all the statements correctly, it will be in. When gfortran is done, we will see if it will be a beautiful butterfly or just a big bug. The start of the GNU Fortran 95 project was announced on the GCC website on March 18, 2000 (although of course Andy had already been working on it for a while).

Gfortran is currently reaching the stage where it is able to compile real-world programs.

Compiler Status

Library Status

Proposed Extensions

Compiler extensions

Compile code that saves memory by dynamically allocating shared and module storage either on the stack or heap. Compile setting for the maximum size of the stack frame size before wasting parts to static or heaps. Generate code to check for null pointer dereferences - prints locus of dereference instead of segfaulting.

This includes several new features, including floating-point exceptions, extended use of allocable arrays, C interoperability, Parameterizer data types, and function pointers.

Environment Options

GFORTRAN STDIN UNIT – Unit number for standard input

GFORTRAN STDOUT UNIT – Unit number for standard output

GFORTRAN STDERR UNIT – Unit number for standard error

GFORTRAN USE STDERR:: Send library output to standard

GFORTRAN TMPDIR – Directory for scratch files

GFORTRAN UNBUFFERED ALL – Don’t buffer output

GFORTRAN SHOW LOCUS – Show location for runtime errors

GFORTRAN OPTIONAL PLUS – Print leading + where

GFORTRAN LIST SEPARATOR – Separator for list output

GFORTRAN CONVERT UNIT – Set endianness for

Setting environment variables must be done on the command line or via the export command for sh-compatible shells and viasetenvforcsh-compatible shells. See Section 7.13 [CONVERT Specifier], page 31, for an alternative way to specify data representation for raw files. By default, '-std=gnu' allows the compiler to accept both types of extensions, but to warn about using the latter.

Specifying "-std=f95" or "-std=f2003" disables both types of extensions, and "-std=legacy" allows both without warning.

Old-style kind specifications

There are currently two categories of gfortran extensions, those that provide functionality beyond that provided by any standard, and those that are supported by gfortran simply for backward compatibility with legacy compilers.

Old-style variable initialization

Extensions to namelist

X format descriptor

Commas in FORMAT specifications

I/O item lists

Hexadecimal constants

Real array indices

Unary operators

Implicitly interconvert LOGICAL and INTEGER

Hollerith constants support

Cray pointers

CONVERT specifier

The type of the pointee can be declared before or after the pointer statement, and the array specification (if any) can be declared before, during, or after the pointer statement. Any expression involving the pointee is translated to use the value stored in the pointer as the base address. There is no malloc implemented intrinsically as part of the Cray pointer extension, but it could be a useful future addition to gfortran.

Subsequent changes to the pointer will not change the base address of the array that was passed.

Introduction to intrinsic procedures

ABORT — Abort the program

ABS — Absolute value

ACHAR — Character in ASCII collating sequence

ACOS — Arc cosine function

ADJUSTL — Left adjust a string

The return value is of type CHARACTER where leading spaces are removed and the same number of spaces are inserted at the end of STR.

ADJUSTR — Right adjust a string

AIMAG — Imaginary part of complex number

AINT — Imaginary part of complex number

ALARM — Execute a routine after a given delay

If STATUS is provided, it will be returned with the number of seconds remaining until any previously scheduled alarms were sent, or zero if there were no previously scheduled alarms.

ALL — All values in MASK along DIM are true

If the rank is greater than one, ALL(MASK,DIM) is determined by applying ALL to the array sections. b, 2) end subroutine section end program test_all.

ALLOCATED — Status of an allocatable entity

ANINT — Nearest whole number

The return value is of type real with the argument's type type parameter if the optional KIND is absent; otherwise the childtype parameter is given by KIND.

ANY — Any value in MASK along DIM is true

ASIN — Arcsine function

ASSOCIATED — Status of a pointer or pointer/target pair

If the optional TGT is not present, then ASSOCIATED(PTR). is true if PTRis is associated with a target; otherwise it returns false. The TGT is not a 0-size storage sequence, and the target associated with the PTR occupies the same storage units. TGT and PTR have the same form, are not arrays of size 0, arrays whose elements are not 0 are large storage sequences, and TGT and PTR occupy the same storage units in array element order.

ATAN — Arctangent function

ATAN2 — Arctangent function

BESJ0 — Bessel function of the first kind of order 0

BESJ1 — Bessel function of the first kind of order 1

BESJN — Bessel function of the first kind

BESY0 — Bessel function of the second kind of order 0

BESY1 — Bessel function of the second kind of order 1

BESYN — Bessel function of the second kind

BIT_SIZE — Bit size inquiry function

BTEST — Bit test function

CEILING — Integer ceiling function

CHAR — Character conversion function

CMPLX — Complex conversion function

COMMAND_ARGUMENT_COUNT — Argument count function

CONJG — Complex conjugate function

COS — Cosine function

COSH — Hyperbolic cosine function

COUNT — Count function

CPU_TIME — CPU elapsed time in seconds

CSHIFT — Circular shift function

CTIME — Convert a time into a string

DATE_AND_TIME — Date and time subroutine

DBLE — Double conversion function

DCMPLX — Double complex conversion function

DFLOAT — Double conversion function

DIGITS — Significant digits function

DIM — Dim function

DOT_PRODUCT — Dot product function

DPROD — Double product function

DREAL — Double real part function

DTIME — Execution time subroutine (or function)

If DTIME is called as a function, it cannot be called as a subroutine, and vice versa.

EOSHIFT — End-off shift function

Therefore, the values ​​returned by this intrinsic value may be or become negative or numerically less than previous values ​​during a single run of the compiled program. If BOUNDARY is present, the corresponding value is copied from BOUNDARY back at the other end. If BOUNDARY is not present, the following is copied depending on the type of ARRAY.

EPSILON — Epsilon function

ERF — Error function

ERFC — Error function

ETIME — Execution time subroutine (or function)

EXIT — Exit the program with status

EXP — Exponential function

EXPONENT — Exponent function

FDATE — Get the current time as a string

FLOAT — Convert integer to default real

FLOOR — Integer floor function

FLUSH — Flush I/O unit(s)

FNUM — File number function

FRACTION — Fractional part of the model representation

FREE — Frees memory

GETGID — Group ID function

GETPID — Process ID function

GETUID — User ID function

HUGE — Largest number of a kind

IACHAR — Code in ASCII collating sequence

ICHAR — Character-to-integer conversion function

IDATE — Get current local time subroutine (day/month/year)

IRAND — Integer pseudo-random number

ITIME — Get current local time subroutine

KIND — Kind of an entity

LOC — Returns the address of a variable

LOG — Logarithm function

LOG10 — Base 10 logarithm function

MALLOC — Allocate dynamic memory

This example is intended to run on 32-bit systems, where the default integer type is suitable for storing pointers; on 64-bit systems ptr x will need to be declared as integer (kind=8).

MAXEXPONENT — Maximum exponent of a real kind

MINEXPONENT — Minimum exponent of a real kind

The return value is of type INTEGER(K), with K such that variables of type INTEGER(K) have the same size as C pointers (sizeof(void.

MOD — Remainder function

MODULO — Modulo function

NEAREST — Nearest representable number

If S is positive, NEAREST returns the number represented by the processor greater than X and closest to it. If S is negative, NEAREST returns the number represented by the processor that is less than and closest to X.

NINT — Nearest whole number

PRECISION — Decimal precision of a real kind

RADIX — Base of a model number

RAND — Real pseudo-random number

RANGE — Decimal exponent range of a real kind

REAL — Convert to real type

RRSPACING — Reciprocal of the relative spacing

SCALE — Scale a real value

SELECTED_INT_KIND — Choose integer kind

SELECTED_REAL_KIND — Choose real kind

If more than one real data type meets the criteria, the data type with the smallest decimal precision is returned. 1 if the processor does not support a real data type with accuracy greater than or equal to P. 2 if the processor does not support a real type with an exponent range greater than or equal to R.

SECNDS — Time subroutine

SET_EXPONENT — Set the exponent of the model

SIGN — Sign copying function

SIGNAL — Signal handling subroutine (or function)

SIN — Sine function

SINH — Hyperbolic sine function

SNGL — Convert double precision real to default real

SQRT — Square-root function

Notes: The Fortran 2003 standard specifies the intrinsic RANDOM_SEED to initialize the pseudo-random number generator and RANDOM_NUMBER to generate pseudo-random numbers. Please note that in gfortran, these two internal arrays (RAND, IRAND, and SRAND on the one hand, RANDOM_NUMBER and RANDOM_SEED on the other) access two independent pseudo-random number generators. TINY(X) returns the smallest positive (non-zero) number in the pattern of type X.

The return value is of the same type and kind as X Example: See BIG for an example. We always need more people helping with ideas and comments, writing documentation and contributing code. If you want to contribute to GNU Fortran 95, check out the long lists of projects you can take on.

Some of these projects are small, some of them are large; some are completely orthogonal to the rest of what happens on gfortran, but others are "mainstream". We will eventually get around to the things here, but they are also things that can be done by someone who is willing and able.

Contributors to GNU Fortran 95

If you have already done so and would like your name to appear on the list above, please contact us.

Projects

In the future it may also support other variants and extensions to the Fortran language.

Fortran 2003 status

You may copy and distribute the Program (or a work based on it, subject to Section 2) in object code or executable form under the terms of Sections 1 and 2 above, provided that you also do one of the following: This Section intended to fully clarify what is believed to be the consequence of the rest of this license. The Free Software Foundation may from time to time publish revised and/or new versions of the General Public License.

THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. You should have received a copy of the GNU General Public License with this program; if not, write to the Free Software. This license is a kind of "copyleft", which means that derivative works of the document itself must be free in the same sense.

On the Title Page, list the name of the publisher of the Custom Version as the publisher. Make the same adjustment to the section titles in the list of Invariant Sections in the licensing notice of the combined work. When the Document is included in an aggregate, this License does not apply to the other works in the aggregate that are not themselves derivative works of the Document.

Translation is considered a type of modification, so you may distribute translations of the Document under the terms of Section 4. The Free Software Foundation may from time to time publish new, revised versions of the GNU Free Documentation License.

Referências

Documentos relacionados

Como estudante em Tübingen (1788-1793), preocupou-se com a demonstração de uma moralidade racional, levando a uma investigação da religião cristã e