On this page
Short Table of Contents
- 1 Introduction
- 2 GNU Fortran Command Options
- 3 Runtime: Influencing runtime behavior with environment variables
- 4 Compiler Characteristics
- 5 Extensions
- 6 Mixed-Language Programming
- 7 Coarray Programming
- 8 Intrinsic Procedures
- 9 Intrinsic Modules
- Contributing
- GNU General Public License
- GNU Free Documentation License
- Funding Free Software
- Option Index
- Keyword Index
Table of Contents
- 1 Introduction
- 2 GNU Fortran Command Options
- 2.1 Option summary
- 2.2 Options controlling Fortran dialect
- 2.3 Enable and customize preprocessing
- 2.4 Options to request or suppress errors and warnings
- 2.5 Options for debugging your program or GNU Fortran
- 2.6 Options for directory search
- 2.7 Influencing the linking step
- 2.8 Influencing runtime behavior
- 2.9 Options for code generation conventions
- 2.10 Options for interoperability with other languages
- 2.11 Environment variables affecting
gfortran
- 3 Runtime: Influencing runtime behavior with environment variables
- 3.1
TMPDIR
—Directory for scratch files - 3.2
GFORTRAN_STDIN_UNIT
—Unit number for standard input - 3.3
GFORTRAN_STDOUT_UNIT
—Unit number for standard output - 3.4
GFORTRAN_STDERR_UNIT
—Unit number for standard error - 3.5
GFORTRAN_UNBUFFERED_ALL
—Do not buffer I/O on all units - 3.6
GFORTRAN_UNBUFFERED_PRECONNECTED
—Do not buffer I/O on preconnected units - 3.7
GFORTRAN_SHOW_LOCUS
—Show location for runtime errors - 3.8
GFORTRAN_OPTIONAL_PLUS
—Print leading + where permitted - 3.9
GFORTRAN_LIST_SEPARATOR
—Separator for list output - 3.10
GFORTRAN_CONVERT_UNIT
—Set conversion for unformatted I/O - 3.11
GFORTRAN_ERROR_BACKTRACE
—Show backtrace on run-time errors - 3.12
GFORTRAN_FORMATTED_BUFFER_SIZE
—Set buffer size for formatted I/O - 3.13
GFORTRAN_UNFORMATTED_BUFFER_SIZE
—Set buffer size for unformatted I/O
- 3.1
- 4 Compiler Characteristics
- 4.1 KIND Type Parameters
- 4.2 Internal representation of LOGICAL variables
- 4.3 Evaluation of logical expressions
- 4.4 MAX and MIN intrinsics with REAL NaN arguments
- 4.5 Thread-safety of the runtime library
- 4.6 Data consistency and durability
- 4.7 Files opened without an explicit ACTION= specifier
- 4.8 File operations on symbolic links
- 4.9 File format of unformatted sequential files
- 4.10 Asynchronous I/O
- 4.11 Behavior on integer overflow
- 5 Extensions
- 5.1 Extensions implemented in GNU Fortran
- 5.1.1 Old-style kind specifications
- 5.1.2 Old-style variable initialization
- 5.1.3 Extensions to namelist
- 5.1.4
X
format descriptor without count field - 5.1.5 Commas in
FORMAT
specifications - 5.1.6 Missing period in
FORMAT
specifications - 5.1.7 Default widths for
F
,G
andI
format descriptors - 5.1.8 I/O item lists
- 5.1.9
Q
exponent-letter - 5.1.10 BOZ literal constants
- 5.1.11 Real array indices
- 5.1.12 Unary operators
- 5.1.13 Implicitly convert
LOGICAL
andINTEGER
values - 5.1.14 Hollerith constants support
- 5.1.15 Character conversion
- 5.1.16 Cray pointers
- 5.1.17
CONVERT
specifier - 5.1.18 OpenMP
- 5.1.19 OpenACC
- 5.1.20 Argument list functions
%VAL
,%REF
and%LOC
- 5.1.21 Read/Write after EOF marker
- 5.1.22
STRUCTURE
andRECORD
- 5.1.23
UNION
andMAP
- 5.1.24 Type variants for integer intrinsics
- 5.1.25
AUTOMATIC
andSTATIC
attributes - 5.1.26 Extended math intrinsics
- 5.1.27 Form feed as whitespace
- 5.1.28 TYPE as an alias for PRINT
- 5.1.29 %LOC as an rvalue
- 5.1.30 .XOR. operator
- 5.1.31 Bitwise logical operators
- 5.1.32 Extended I/O specifiers
- 5.1.33 Legacy PARAMETER statements
- 5.1.34 Default exponents
- 5.2 Extensions not implemented in GNU Fortran
- 5.1 Extensions implemented in GNU Fortran
- 6 Mixed-Language Programming
- 6.1 Interoperability with C
- 6.2 GNU Fortran Compiler Directives
- 6.3 Non-Fortran Main Program
- 6.3.1
_gfortran_set_args
— Save command-line arguments - 6.3.2
_gfortran_set_options
— Set library option flags - 6.3.3
_gfortran_set_convert
— Set endian conversion - 6.3.4
_gfortran_set_record_marker
— Set length of record markers - 6.3.5
_gfortran_set_fpe
— Enable floating point exception traps - 6.3.6
_gfortran_set_max_subrecord_length
— Set subrecord length
- 6.3.1
- 6.4 Naming and argument-passing conventions
- 7 Coarray Programming
- 7.1 Type and enum ABI Documentation
- 7.2 Function ABI Documentation
- 7.2.1
_gfortran_caf_init
— Initialiation function - 7.2.2
_gfortran_caf_finish
— Finalization function - 7.2.3
_gfortran_caf_this_image
— Querying the image number - 7.2.4
_gfortran_caf_num_images
— Querying the maximal number of images - 7.2.5
_gfortran_caf_image_status
— Query the status of an image - 7.2.6
_gfortran_caf_failed_images
— Get an array of the indexes of the failed images - 7.2.7
_gfortran_caf_stopped_images
— Get an array of the indexes of the stopped images - 7.2.8
_gfortran_caf_register
— Registering coarrays - 7.2.9
_gfortran_caf_deregister
— Deregistering coarrays - 7.2.10
_gfortran_caf_is_present
— Query whether an allocatable or pointer component in a derived type coarray is allocated - 7.2.11
_gfortran_caf_send
— Sending data from a local image to a remote image - 7.2.12
_gfortran_caf_get
— Getting data from a remote image - 7.2.13
_gfortran_caf_sendget
— Sending data between remote images - 7.2.14
_gfortran_caf_send_by_ref
— Sending data from a local image to a remote image with enhanced referencing options - 7.2.15
_gfortran_caf_get_by_ref
— Getting data from a remote image using enhanced references - 7.2.16
_gfortran_caf_sendget_by_ref
— Sending data between remote images using enhanced references on both sides - 7.2.17
_gfortran_caf_lock
— Locking a lock variable - 7.2.18
_gfortran_caf_lock
— Unlocking a lock variable - 7.2.19
_gfortran_caf_event_post
— Post an event - 7.2.20
_gfortran_caf_event_wait
— Wait that an event occurred - 7.2.21
_gfortran_caf_event_query
— Query event count - 7.2.22
_gfortran_caf_sync_all
— All-image barrier - 7.2.23
_gfortran_caf_sync_images
— Barrier for selected images - 7.2.24
_gfortran_caf_sync_memory
— Wait for completion of segment-memory operations - 7.2.25
_gfortran_caf_error_stop
— Error termination with exit code - 7.2.26
_gfortran_caf_error_stop_str
— Error termination with string - 7.2.27
_gfortran_caf_fail_image
— Mark the image failed and end its execution - 7.2.28
_gfortran_caf_atomic_define
— Atomic variable assignment - 7.2.29
_gfortran_caf_atomic_ref
— Atomic variable reference - 7.2.30
_gfortran_caf_atomic_cas
— Atomic compare and swap - 7.2.31
_gfortran_caf_atomic_op
— Atomic operation - 7.2.32
_gfortran_caf_co_broadcast
— Sending data to all images - 7.2.33
_gfortran_caf_co_max
— Collective maximum reduction - 7.2.34
_gfortran_caf_co_min
— Collective minimum reduction - 7.2.35
_gfortran_caf_co_sum
— Collective summing reduction - 7.2.36
_gfortran_caf_co_reduce
— Generic collective reduction
- 7.2.1
- 8 Intrinsic Procedures
- 8.1 Introduction to intrinsic procedures
- 8.2
ABORT
— Abort the program - 8.3
ABS
— Absolute value - 8.4
ACCESS
— Checks file access modes - 8.5
ACHAR
— Character in ASCII collating sequence - 8.6
ACOS
— Arccosine function - 8.7
ACOSD
— Arccosine function, degrees - 8.8
ACOSH
— Inverse hyperbolic cosine function - 8.9
ADJUSTL
— Left adjust a string - 8.10
ADJUSTR
— Right adjust a string - 8.11
AIMAG
— Imaginary part of complex number - 8.12
AINT
— Truncate to a whole number - 8.13
ALARM
— Execute a routine after a given delay - 8.14
ALL
— All values in MASK along DIM are true - 8.15
ALLOCATED
— Status of an allocatable entity - 8.16
AND
— Bitwise logical AND - 8.17
ANINT
— Nearest whole number - 8.18
ANY
— Any value in MASK along DIM is true - 8.19
ASIN
— Arcsine function - 8.20
ASIND
— Arcsine function, degrees - 8.21
ASINH
— Inverse hyperbolic sine function - 8.22
ASSOCIATED
— Status of a pointer or pointer/target pair - 8.23
ATAN
— Arctangent function - 8.24
ATAND
— Arctangent function, degrees - 8.25
ATAN2
— Arctangent function - 8.26
ATAN2D
— Arctangent function, degrees - 8.27
ATANH
— Inverse hyperbolic tangent function - 8.28
ATOMIC_ADD
— Atomic ADD operation - 8.29
ATOMIC_AND
— Atomic bitwise AND operation - 8.30
ATOMIC_CAS
— Atomic compare and swap - 8.31
ATOMIC_DEFINE
— Setting a variable atomically - 8.32
ATOMIC_FETCH_ADD
— Atomic ADD operation with prior fetch - 8.33
ATOMIC_FETCH_AND
— Atomic bitwise AND operation with prior fetch - 8.34
ATOMIC_FETCH_OR
— Atomic bitwise OR operation with prior fetch - 8.35
ATOMIC_FETCH_XOR
— Atomic bitwise XOR operation with prior fetch - 8.36
ATOMIC_OR
— Atomic bitwise OR operation - 8.37
ATOMIC_REF
— Obtaining the value of a variable atomically - 8.38
ATOMIC_XOR
— Atomic bitwise OR operation - 8.39
BACKTRACE
— Show a backtrace - 8.40
BESSEL_J0
— Bessel function of the first kind of order 0 - 8.41
BESSEL_J1
— Bessel function of the first kind of order 1 - 8.42
BESSEL_JN
— Bessel function of the first kind - 8.43
BESSEL_Y0
— Bessel function of the second kind of order 0 - 8.44
BESSEL_Y1
— Bessel function of the second kind of order 1 - 8.45
BESSEL_YN
— Bessel function of the second kind - 8.46
BGE
— Bitwise greater than or equal to - 8.47
BGT
— Bitwise greater than - 8.48
BIT_SIZE
— Bit size inquiry function - 8.49
BLE
— Bitwise less than or equal to - 8.50
BLT
— Bitwise less than - 8.51
BTEST
— Bit test function - 8.52
C_ASSOCIATED
— Status of a C pointer - 8.53
C_F_POINTER
— Convert C into Fortran pointer - 8.54
C_F_PROCPOINTER
— Convert C into Fortran procedure pointer - 8.55
C_FUNLOC
— Obtain the C address of a procedure - 8.56
C_LOC
— Obtain the C address of an object - 8.57
C_SIZEOF
— Size in bytes of an expression - 8.58
CEILING
— Integer ceiling function - 8.59
CHAR
— Character conversion function - 8.60
CHDIR
— Change working directory - 8.61
CHMOD
— Change access permissions of files - 8.62
CMPLX
— Complex conversion function - 8.63
CO_BROADCAST
— Copy a value to all images the current set of images - 8.64
CO_MAX
— Maximal value on the current set of images - 8.65
CO_MIN
— Minimal value on the current set of images - 8.66
CO_REDUCE
— Reduction of values on the current set of images - 8.67
CO_SUM
— Sum of values on the current set of images - 8.68
COMMAND_ARGUMENT_COUNT
— Get number of command line arguments - 8.69
COMPILER_OPTIONS
— Options passed to the compiler - 8.70
COMPILER_VERSION
— Compiler version string - 8.71
COMPLEX
— Complex conversion function - 8.72
CONJG
— Complex conjugate function - 8.73
COS
— Cosine function - 8.74
COSD
— Cosine function, degrees - 8.75
COSH
— Hyperbolic cosine function - 8.76
COTAN
— Cotangent function - 8.77
COTAND
— Cotangent function, degrees - 8.78
COUNT
— Count function - 8.79
CPU_TIME
— CPU elapsed time in seconds - 8.80
CSHIFT
— Circular shift elements of an array - 8.81
CTIME
— Convert a time into a string - 8.82
DATE_AND_TIME
— Date and time subroutine - 8.83
DBLE
— Double conversion function - 8.84
DCMPLX
— Double complex conversion function - 8.85
DIGITS
— Significant binary digits function - 8.86
DIM
— Positive difference - 8.87
DOT_PRODUCT
— Dot product function - 8.88
DPROD
— Double product function - 8.89
DREAL
— Double real part function - 8.90
DSHIFTL
— Combined left shift - 8.91
DSHIFTR
— Combined right shift - 8.92
DTIME
— Execution time subroutine (or function) - 8.93
EOSHIFT
— End-off shift elements of an array - 8.94
EPSILON
— Epsilon function - 8.95
ERF
— Error function - 8.96
ERFC
— Error function - 8.97
ERFC_SCALED
— Error function - 8.98
ETIME
— Execution time subroutine (or function) - 8.99
EVENT_QUERY
— Query whether a coarray event has occurred - 8.100
EXECUTE_COMMAND_LINE
— Execute a shell command - 8.101
EXIT
— Exit the program with status. - 8.102
EXP
— Exponential function - 8.103
EXPONENT
— Exponent function - 8.104
EXTENDS_TYPE_OF
— Query dynamic type for extension - 8.105
FDATE
— Get the current time as a string - 8.106
FGET
— Read a single character in stream mode from stdin - 8.107
FGETC
— Read a single character in stream mode - 8.108
FINDLOC
— Search an array for a value - 8.109
FLOOR
— Integer floor function - 8.110
FLUSH
— Flush I/O unit(s) - 8.111
FNUM
— File number function - 8.112
FPUT
— Write a single character in stream mode to stdout - 8.113
FPUTC
— Write a single character in stream mode - 8.114
FRACTION
— Fractional part of the model representation - 8.115
FREE
— Frees memory - 8.116
FSEEK
— Low level file positioning subroutine - 8.117
FSTAT
— Get file status - 8.118
FTELL
— Current stream position - 8.119
GAMMA
— Gamma function - 8.120
GERROR
— Get last system error message - 8.121
GETARG
— Get command line arguments - 8.122
GET_COMMAND
— Get the entire command line - 8.123
GET_COMMAND_ARGUMENT
— Get command line arguments - 8.124
GETCWD
— Get current working directory - 8.125
GETENV
— Get an environmental variable - 8.126
GET_ENVIRONMENT_VARIABLE
— Get an environmental variable - 8.127
GETGID
— Group ID function - 8.128
GETLOG
— Get login name - 8.129
GETPID
— Process ID function - 8.130
GETUID
— User ID function - 8.131
GMTIME
— Convert time to GMT info - 8.132
HOSTNM
— Get system host name - 8.133
HUGE
— Largest number of a kind - 8.134
HYPOT
— Euclidean distance function - 8.135
IACHAR
— Code in ASCII collating sequence - 8.136
IALL
— Bitwise AND of array elements - 8.137
IAND
— Bitwise logical and - 8.138
IANY
— Bitwise OR of array elements - 8.139
IARGC
— Get the number of command line arguments - 8.140
IBCLR
— Clear bit - 8.141
IBITS
— Bit extraction - 8.142
IBSET
— Set bit - 8.143
ICHAR
— Character-to-integer conversion function - 8.144
IDATE
— Get current local time subroutine (day/month/year) - 8.145
IEOR
— Bitwise logical exclusive or - 8.146
IERRNO
— Get the last system error number - 8.147
IMAGE_INDEX
— Function that converts a cosubscript to an image index - 8.148
INDEX
— Position of a substring within a string - 8.149
INT
— Convert to integer type - 8.150
INT2
— Convert to 16-bit integer type - 8.151
INT8
— Convert to 64-bit integer type - 8.152
IOR
— Bitwise logical or - 8.153
IPARITY
— Bitwise XOR of array elements - 8.154
IRAND
— Integer pseudo-random number - 8.155
IS_CONTIGUOUS
— Test whether an array is contiguous - 8.156
IS_IOSTAT_END
— Test for end-of-file value - 8.157
IS_IOSTAT_EOR
— Test for end-of-record value - 8.158
ISATTY
— Whether a unit is a terminal device - 8.159
ISHFT
— Shift bits - 8.160
ISHFTC
— Shift bits circularly - 8.161
ISNAN
— Test for a NaN - 8.162
ITIME
— Get current local time subroutine (hour/minutes/seconds) - 8.163
KILL
— Send a signal to a process - 8.164
KIND
— Kind of an entity - 8.165
LBOUND
— Lower dimension bounds of an array - 8.166
LCOBOUND
— Lower codimension bounds of an array - 8.167
LEADZ
— Number of leading zero bits of an integer - 8.168
LEN
— Length of a character entity - 8.169
LEN_TRIM
— Length of a character entity without trailing blank characters - 8.170
LGE
— Lexical greater than or equal - 8.171
LGT
— Lexical greater than - 8.172
LINK
— Create a hard link - 8.173
LLE
— Lexical less than or equal - 8.174
LLT
— Lexical less than - 8.175
LNBLNK
— Index of the last non-blank character in a string - 8.176
LOC
— Returns the address of a variable - 8.177
LOG
— Natural logarithm function - 8.178
LOG10
— Base 10 logarithm function - 8.179
LOG_GAMMA
— Logarithm of the Gamma function - 8.180
LOGICAL
— Convert to logical type - 8.181
LSHIFT
— Left shift bits - 8.182
LSTAT
— Get file status - 8.183
LTIME
— Convert time to local time info - 8.184
MALLOC
— Allocate dynamic memory - 8.185
MASKL
— Left justified mask - 8.186
MASKR
— Right justified mask - 8.187
MATMUL
— matrix multiplication - 8.188
MAX
— Maximum value of an argument list - 8.189
MAXEXPONENT
— Maximum exponent of a real kind - 8.190
MAXLOC
— Location of the maximum value within an array - 8.191
MAXVAL
— Maximum value of an array - 8.192
MCLOCK
— Time function - 8.193
MCLOCK8
— Time function (64-bit) - 8.194
MERGE
— Merge variables - 8.195
MERGE_BITS
— Merge of bits under mask - 8.196
MIN
— Minimum value of an argument list - 8.197
MINEXPONENT
— Minimum exponent of a real kind - 8.198
MINLOC
— Location of the minimum value within an array - 8.199
MINVAL
— Minimum value of an array - 8.200
MOD
— Remainder function - 8.201
MODULO
— Modulo function - 8.202
MOVE_ALLOC
— Move allocation from one object to another - 8.203
MVBITS
— Move bits from one integer to another - 8.204
NEAREST
— Nearest representable number - 8.205
NEW_LINE
— New line character - 8.206
NINT
— Nearest whole number - 8.207
NORM2
— Euclidean vector norms - 8.208
NOT
— Logical negation - 8.209
NULL
— Function that returns an disassociated pointer - 8.210
NUM_IMAGES
— Function that returns the number of images - 8.211
OR
— Bitwise logical OR - 8.212
PACK
— Pack an array into an array of rank one - 8.213
PARITY
— Reduction with exclusive OR - 8.214
PERROR
— Print system error message - 8.215
POPCNT
— Number of bits set - 8.216
POPPAR
— Parity of the number of bits set - 8.217
PRECISION
— Decimal precision of a real kind - 8.218
PRESENT
— Determine whether an optional dummy argument is specified - 8.219
PRODUCT
— Product of array elements - 8.220
RADIX
— Base of a model number - 8.221
RAN
— Real pseudo-random number - 8.222
RAND
— Real pseudo-random number - 8.223
RANDOM_INIT
— Initialize a pseudo-random number generator - 8.224
RANDOM_NUMBER
— Pseudo-random number - 8.225
RANDOM_SEED
— Initialize a pseudo-random number sequence - 8.226
RANGE
— Decimal exponent range - 8.227
RANK
— Rank of a data object - 8.228
REAL
— Convert to real type - 8.229
RENAME
— Rename a file - 8.230
REPEAT
— Repeated string concatenation - 8.231
RESHAPE
— Function to reshape an array - 8.232
RRSPACING
— Reciprocal of the relative spacing - 8.233
RSHIFT
— Right shift bits - 8.234
SAME_TYPE_AS
— Query dynamic types for equality - 8.235
SCALE
— Scale a real value - 8.236
SCAN
— Scan a string for the presence of a set of characters - 8.237
SECNDS
— Time function - 8.238
SECOND
— CPU time function - 8.239
SELECTED_CHAR_KIND
— Choose character kind - 8.240
SELECTED_INT_KIND
— Choose integer kind - 8.241
SELECTED_REAL_KIND
— Choose real kind - 8.242
SET_EXPONENT
— Set the exponent of the model - 8.243
SHAPE
— Determine the shape of an array - 8.244
SHIFTA
— Right shift with fill - 8.245
SHIFTL
— Left shift - 8.246
SHIFTR
— Right shift - 8.247
SIGN
— Sign copying function - 8.248
SIGNAL
— Signal handling subroutine (or function) - 8.249
SIN
— Sine function - 8.250
SIND
— Sine function, degrees - 8.251
SINH
— Hyperbolic sine function - 8.252
SIZE
— Determine the size of an array - 8.253
SIZEOF
— Size in bytes of an expression - 8.254
SLEEP
— Sleep for the specified number of seconds - 8.255
SPACING
— Smallest distance between two numbers of a given type - 8.256
SPREAD
— Add a dimension to an array - 8.257
SQRT
— Square-root function - 8.258
SRAND
— Reinitialize the random number generator - 8.259
STAT
— Get file status - 8.260
STORAGE_SIZE
— Storage size in bits - 8.261
SUM
— Sum of array elements - 8.262
SYMLNK
— Create a symbolic link - 8.263
SYSTEM
— Execute a shell command - 8.264
SYSTEM_CLOCK
— Time function - 8.265
TAN
— Tangent function - 8.266
TAND
— Tangent function, degrees - 8.267
TANH
— Hyperbolic tangent function - 8.268
THIS_IMAGE
— Function that returns the cosubscript index of this image - 8.269
TIME
— Time function - 8.270
TIME8
— Time function (64-bit) - 8.271
TINY
— Smallest positive number of a real kind - 8.272
TRAILZ
— Number of trailing zero bits of an integer - 8.273
TRANSFER
— Transfer bit patterns - 8.274
TRANSPOSE
— Transpose an array of rank two - 8.275
TRIM
— Remove trailing blank characters of a string - 8.276
TTYNAM
— Get the name of a terminal device - 8.277
UBOUND
— Upper dimension bounds of an array - 8.278
UCOBOUND
— Upper codimension bounds of an array - 8.279
UMASK
— Set the file creation mask - 8.280
UNLINK
— Remove a file from the file system - 8.281
UNPACK
— Unpack an array of rank one into an array - 8.282
VERIFY
— Scan a string for characters not a given set - 8.283
XOR
— Bitwise logical exclusive OR
- 9 Intrinsic Modules
- Contributing
- GNU General Public License
- GNU Free Documentation License
- Funding Free Software
- Option Index
- Keyword Index
Introduction ¶
This manual documents the use of gfortran
, the GNU Fortran compiler. You can find in this manual how to invoke gfortran
, as well as its features and incompatibilities.
- Introduction
- GNU Fortran Command Options
- Runtime: Influencing runtime behavior with environment variables
- Compiler Characteristics
- Extensions
- Mixed-Language Programming
- Coarray Programming
- Intrinsic Procedures
- Intrinsic Modules
- Contributing
- GNU General Public License
- GNU Free Documentation License
- Funding Free Software
- Option Index
- Keyword Index
© Free Software Foundation
Licensed under the GNU Free Documentation License, Version 1.3.
https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gfortran/index.html