The GNU Fortran Compiler
Short Table of Contents
- 1 Introduction
- 2 GNU Fortran Command Options
- 3 Runtime: Influencing runtime behavior with environment variables
- 4 Fortran standards status
- 5 Compiler Characteristics
- 6 Extensions
- 7 Mixed-Language Programming
- 8 Coarray Programming
- 9 Intrinsic Procedures
- 10 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 endianness 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 Fortran standards status
-
5 Compiler Characteristics
- 5.1 KIND Type Parameters
- 5.2 Internal representation of LOGICAL variables
- 5.3 Evaluation of logical expressions
- 5.4 MAX and MIN intrinsics with REAL NaN arguments
- 5.5 Thread-safety of the runtime library
- 5.6 Data consistency and durability
- 5.7 Files opened without an explicit ACTION= specifier
- 5.8 File operations on symbolic links
- 5.9 File format of unformatted sequential files
- 5.10 Asynchronous I/O
-
6 Extensions
-
6.1 Extensions implemented in GNU Fortran
- 6.1.1 Old-style kind specifications
- 6.1.2 Old-style variable initialization
- 6.1.3 Extensions to namelist
- 6.1.4
Xformat descriptor without count field - 6.1.5 Commas in
FORMATspecifications - 6.1.6 Missing period in
FORMATspecifications - 6.1.7 Default widths for
F,GandIformat descriptors - 6.1.8 I/O item lists
- 6.1.9
Qexponent-letter - 6.1.10 BOZ literal constants
- 6.1.11 Real array indices
- 6.1.12 Unary operators
- 6.1.13 Implicitly convert
LOGICALandINTEGERvalues - 6.1.14 Hollerith constants support
- 6.1.15 Character conversion
- 6.1.16 Cray pointers
- 6.1.17
CONVERTspecifier - 6.1.18 OpenMP
- 6.1.19 OpenACC
- 6.1.20 Argument list functions
%VAL,%REFand%LOC - 6.1.21 Read/Write after EOF marker
- 6.1.22
STRUCTUREandRECORD - 6.1.23
UNIONandMAP - 6.1.24 Type variants for integer intrinsics
- 6.1.25
AUTOMATICandSTATICattributes - 6.1.26 Extended math intrinsics
- 6.1.27 Form feed as whitespace
- 6.1.28 TYPE as an alias for PRINT
- 6.1.29 %LOC as an rvalue
- 6.1.30 .XOR. operator
- 6.1.31 Bitwise logical operators
- 6.1.32 Extended I/O specifiers
- 6.1.33 Legacy PARAMETER statements
- 6.1.34 Default exponents
- 6.2 Extensions not implemented in GNU Fortran
-
6.1 Extensions implemented in GNU Fortran
-
7 Mixed-Language Programming
- 7.1 Interoperability with C
- 7.2 GNU Fortran Compiler Directives
-
7.3 Non-Fortran Main Program
- 7.3.1
_gfortran_set_args— Save command-line arguments - 7.3.2
_gfortran_set_options— Set library option flags - 7.3.3
_gfortran_set_convert— Set endian conversion - 7.3.4
_gfortran_set_record_marker— Set length of record markers - 7.3.5
_gfortran_set_fpe— Enable floating point exception traps - 7.3.6
_gfortran_set_max_subrecord_length— Set subrecord length
- 7.3.1
- 7.4 Naming and argument-passing conventions
-
8 Coarray Programming
- 8.1 Type and enum ABI Documentation
-
8.2 Function ABI Documentation
- 8.2.1
_gfortran_caf_init— Initialiation function - 8.2.2
_gfortran_caf_finish— Finalization function - 8.2.3
_gfortran_caf_this_image— Querying the image number - 8.2.4
_gfortran_caf_num_images— Querying the maximal number of images - 8.2.5
_gfortran_caf_image_status— Query the status of an image - 8.2.6
_gfortran_caf_failed_images— Get an array of the indexes of the failed images - 8.2.7
_gfortran_caf_stopped_images— Get an array of the indexes of the stopped images - 8.2.8
_gfortran_caf_register— Registering coarrays - 8.2.9
_gfortran_caf_deregister— Deregistering coarrays - 8.2.10
_gfortran_caf_is_present— Query whether an allocatable or pointer component in a derived type coarray is allocated - 8.2.11
_gfortran_caf_send— Sending data from a local image to a remote image - 8.2.12
_gfortran_caf_get— Getting data from a remote image - 8.2.13
_gfortran_caf_sendget— Sending data between remote images - 8.2.14
_gfortran_caf_send_by_ref— Sending data from a local image to a remote image with enhanced referencing options - 8.2.15
_gfortran_caf_get_by_ref— Getting data from a remote image using enhanced references - 8.2.16
_gfortran_caf_sendget_by_ref— Sending data between remote images using enhanced references on both sides - 8.2.17
_gfortran_caf_lock— Locking a lock variable - 8.2.18
_gfortran_caf_lock— Unlocking a lock variable - 8.2.19
_gfortran_caf_event_post— Post an event - 8.2.20
_gfortran_caf_event_wait— Wait that an event occurred - 8.2.21
_gfortran_caf_event_query— Query event count - 8.2.22
_gfortran_caf_sync_all— All-image barrier - 8.2.23
_gfortran_caf_sync_images— Barrier for selected images - 8.2.24
_gfortran_caf_sync_memory— Wait for completion of segment-memory operations - 8.2.25
_gfortran_caf_error_stop— Error termination with exit code - 8.2.26
_gfortran_caf_error_stop_str— Error termination with string - 8.2.27
_gfortran_caf_fail_image— Mark the image failed and end its execution - 8.2.28
_gfortran_caf_atomic_define— Atomic variable assignment - 8.2.29
_gfortran_caf_atomic_ref— Atomic variable reference - 8.2.30
_gfortran_caf_atomic_cas— Atomic compare and swap - 8.2.31
_gfortran_caf_atomic_op— Atomic operation - 8.2.32
_gfortran_caf_co_broadcast— Sending data to all images - 8.2.33
_gfortran_caf_co_max— Collective maximum reduction - 8.2.34
_gfortran_caf_co_min— Collective minimum reduction - 8.2.35
_gfortran_caf_co_sum— Collective summing reduction - 8.2.36
_gfortran_caf_co_reduce— Generic collective reduction
- 8.2.1
-
9 Intrinsic Procedures
- 9.1 Introduction to intrinsic procedures
- 9.2
ABORT— Abort the program - 9.3
ABS— Absolute value - 9.4
ACCESS— Checks file access modes - 9.5
ACHAR— Character in ASCII collating sequence - 9.6
ACOS— Arccosine function - 9.7
ACOSD— Arccosine function, degrees - 9.8
ACOSH— Inverse hyperbolic cosine function - 9.9
ADJUSTL— Left adjust a string - 9.10
ADJUSTR— Right adjust a string - 9.11
AIMAG— Imaginary part of complex number - 9.12
AINT— Truncate to a whole number - 9.13
ALARM— Execute a routine after a given delay - 9.14
ALL— All values in MASK along DIM are true - 9.15
ALLOCATED— Status of an allocatable entity - 9.16
AND— Bitwise logical AND - 9.17
ANINT— Nearest whole number - 9.18
ANY— Any value in MASK along DIM is true - 9.19
ASIN— Arcsine function - 9.20
ASIND— Arcsine function, degrees - 9.21
ASINH— Inverse hyperbolic sine function - 9.22
ASSOCIATED— Status of a pointer or pointer/target pair - 9.23
ATAN— Arctangent function - 9.24
ATAND— Arctangent function, degrees - 9.25
ATAN2— Arctangent function - 9.26
ATAN2D— Arctangent function, degrees - 9.27
ATANH— Inverse hyperbolic tangent function - 9.28
ATOMIC_ADD— Atomic ADD operation - 9.29
ATOMIC_AND— Atomic bitwise AND operation - 9.30
ATOMIC_CAS— Atomic compare and swap - 9.31
ATOMIC_DEFINE— Setting a variable atomically - 9.32
ATOMIC_FETCH_ADD— Atomic ADD operation with prior fetch - 9.33
ATOMIC_FETCH_AND— Atomic bitwise AND operation with prior fetch - 9.34
ATOMIC_FETCH_OR— Atomic bitwise OR operation with prior fetch - 9.35
ATOMIC_FETCH_XOR— Atomic bitwise XOR operation with prior fetch - 9.36
ATOMIC_OR— Atomic bitwise OR operation - 9.37
ATOMIC_REF— Obtaining the value of a variable atomically - 9.38
ATOMIC_XOR— Atomic bitwise OR operation - 9.39
BACKTRACE— Show a backtrace - 9.40
BESSEL_J0— Bessel function of the first kind of order 0 - 9.41
BESSEL_J1— Bessel function of the first kind of order 1 - 9.42
BESSEL_JN— Bessel function of the first kind - 9.43
BESSEL_Y0— Bessel function of the second kind of order 0 - 9.44
BESSEL_Y1— Bessel function of the second kind of order 1 - 9.45
BESSEL_YN— Bessel function of the second kind - 9.46
BGE— Bitwise greater than or equal to - 9.47
BGT— Bitwise greater than - 9.48
BIT_SIZE— Bit size inquiry function - 9.49
BLE— Bitwise less than or equal to - 9.50
BLT— Bitwise less than - 9.51
BTEST— Bit test function - 9.52
C_ASSOCIATED— Status of a C pointer - 9.53
C_F_POINTER— Convert C into Fortran pointer - 9.54
C_F_PROCPOINTER— Convert C into Fortran procedure pointer - 9.55
C_FUNLOC— Obtain the C address of a procedure - 9.56
C_LOC— Obtain the C address of an object - 9.57
C_SIZEOF— Size in bytes of an expression - 9.58
CEILING— Integer ceiling function - 9.59
CHAR— Character conversion function - 9.60
CHDIR— Change working directory - 9.61
CHMOD— Change access permissions of files - 9.62
CMPLX— Complex conversion function - 9.63
CO_BROADCAST— Copy a value to all images the current set of images - 9.64
CO_MAX— Maximal value on the current set of images - 9.65
CO_MIN— Minimal value on the current set of images - 9.66
CO_REDUCE— Reduction of values on the current set of images - 9.67
CO_SUM— Sum of values on the current set of images - 9.68
COMMAND_ARGUMENT_COUNT— Get number of command line arguments - 9.69
COMPILER_OPTIONS— Options passed to the compiler - 9.70
COMPILER_VERSION— Compiler version string - 9.71
COMPLEX— Complex conversion function - 9.72
CONJG— Complex conjugate function - 9.73
COS— Cosine function - 9.74
COSD— Cosine function, degrees - 9.75
COSH— Hyperbolic cosine function - 9.76
COTAN— Cotangent function - 9.77
COTAND— Cotangent function, degrees - 9.78
COUNT— Count function - 9.79
CPU_TIME— CPU elapsed time in seconds - 9.80
CSHIFT— Circular shift elements of an array - 9.81
CTIME— Convert a time into a string - 9.82
DATE_AND_TIME— Date and time subroutine - 9.83
DBLE— Double conversion function - 9.84
DCMPLX— Double complex conversion function - 9.85
DIGITS— Significant binary digits function - 9.86
DIM— Positive difference - 9.87
DOT_PRODUCT— Dot product function - 9.88
DPROD— Double product function - 9.89
DREAL— Double real part function - 9.90
DSHIFTL— Combined left shift - 9.91
DSHIFTR— Combined right shift - 9.92
DTIME— Execution time subroutine (or function) - 9.93
EOSHIFT— End-off shift elements of an array - 9.94
EPSILON— Epsilon function - 9.95
ERF— Error function - 9.96
ERFC— Error function - 9.97
ERFC_SCALED— Error function - 9.98
ETIME— Execution time subroutine (or function) - 9.99
EVENT_QUERY— Query whether a coarray event has occurred - 9.100
EXECUTE_COMMAND_LINE— Execute a shell command - 9.101
EXIT— Exit the program with status. - 9.102
EXP— Exponential function - 9.103
EXPONENT— Exponent function - 9.104
EXTENDS_TYPE_OF— Query dynamic type for extension - 9.105
FDATE— Get the current time as a string - 9.106
FGET— Read a single character in stream mode from stdin - 9.107
FGETC— Read a single character in stream mode - 9.108
FINDLOC— Search an array for a value - 9.109
FLOOR— Integer floor function - 9.110
FLUSH— Flush I/O unit(s) - 9.111
FNUM— File number function - 9.112
FPUT— Write a single character in stream mode to stdout - 9.113
FPUTC— Write a single character in stream mode - 9.114
FRACTION— Fractional part of the model representation - 9.115
FREE— Frees memory - 9.116
FSEEK— Low level file positioning subroutine - 9.117
FSTAT— Get file status - 9.118
FTELL— Current stream position - 9.119
GAMMA— Gamma function - 9.120
GERROR— Get last system error message - 9.121
GETARG— Get command line arguments - 9.122
GET_COMMAND— Get the entire command line - 9.123
GET_COMMAND_ARGUMENT— Get command line arguments - 9.124
GETCWD— Get current working directory - 9.125
GETENV— Get an environmental variable - 9.126
GET_ENVIRONMENT_VARIABLE— Get an environmental variable - 9.127
GETGID— Group ID function - 9.128
GETLOG— Get login name - 9.129
GETPID— Process ID function - 9.130
GETUID— User ID function - 9.131
GMTIME— Convert time to GMT info - 9.132
HOSTNM— Get system host name - 9.133
HUGE— Largest number of a kind - 9.134
HYPOT— Euclidean distance function - 9.135
IACHAR— Code in ASCII collating sequence - 9.136
IALL— Bitwise AND of array elements - 9.137
IAND— Bitwise logical and - 9.138
IANY— Bitwise OR of array elements - 9.139
IARGC— Get the number of command line arguments - 9.140
IBCLR— Clear bit - 9.141
IBITS— Bit extraction - 9.142
IBSET— Set bit - 9.143
ICHAR— Character-to-integer conversion function - 9.144
IDATE— Get current local time subroutine (day/month/year) - 9.145
IEOR— Bitwise logical exclusive or - 9.146
IERRNO— Get the last system error number - 9.147
IMAGE_INDEX— Function that converts a cosubscript to an image index - 9.148
INDEX— Position of a substring within a string - 9.149
INT— Convert to integer type - 9.150
INT2— Convert to 16-bit integer type - 9.151
INT8— Convert to 64-bit integer type - 9.152
IOR— Bitwise logical or - 9.153
IPARITY— Bitwise XOR of array elements - 9.154
IRAND— Integer pseudo-random number - 9.155
IS_CONTIGUOUS— Test whether an array is contiguous - 9.156
IS_IOSTAT_END— Test for end-of-file value - 9.157
IS_IOSTAT_EOR— Test for end-of-record value - 9.158
ISATTY— Whether a unit is a terminal device. - 9.159
ISHFT— Shift bits - 9.160
ISHFTC— Shift bits circularly - 9.161
ISNAN— Test for a NaN - 9.162
ITIME— Get current local time subroutine (hour/minutes/seconds) - 9.163
KILL— Send a signal to a process - 9.164
KIND— Kind of an entity - 9.165
LBOUND— Lower dimension bounds of an array - 9.166
LCOBOUND— Lower codimension bounds of an array - 9.167
LEADZ— Number of leading zero bits of an integer - 9.168
LEN— Length of a character entity - 9.169
LEN_TRIM— Length of a character entity without trailing blank characters - 9.170
LGE— Lexical greater than or equal - 9.171
LGT— Lexical greater than - 9.172
LINK— Create a hard link - 9.173
LLE— Lexical less than or equal - 9.174
LLT— Lexical less than - 9.175
LNBLNK— Index of the last non-blank character in a string - 9.176
LOC— Returns the address of a variable - 9.177
LOG— Natural logarithm function - 9.178
LOG10— Base 10 logarithm function - 9.179
LOG_GAMMA— Logarithm of the Gamma function - 9.180
LOGICAL— Convert to logical type - 9.181
LONG— Convert to integer type - 9.182
LSHIFT— Left shift bits - 9.183
LSTAT— Get file status - 9.184
LTIME— Convert time to local time info - 9.185
MALLOC— Allocate dynamic memory - 9.186
MASKL— Left justified mask - 9.187
MASKR— Right justified mask - 9.188
MATMUL— matrix multiplication - 9.189
MAX— Maximum value of an argument list - 9.190
MAXEXPONENT— Maximum exponent of a real kind - 9.191
MAXLOC— Location of the maximum value within an array - 9.192
MAXVAL— Maximum value of an array - 9.193
MCLOCK— Time function - 9.194
MCLOCK8— Time function (64-bit) - 9.195
MERGE— Merge variables - 9.196
MERGE_BITS— Merge of bits under mask - 9.197
MIN— Minimum value of an argument list - 9.198
MINEXPONENT— Minimum exponent of a real kind - 9.199
MINLOC— Location of the minimum value within an array - 9.200
MINVAL— Minimum value of an array - 9.201
MOD— Remainder function - 9.202
MODULO— Modulo function - 9.203
MOVE_ALLOC— Move allocation from one object to another - 9.204
MVBITS— Move bits from one integer to another - 9.205
NEAREST— Nearest representable number - 9.206
NEW_LINE— New line character - 9.207
NINT— Nearest whole number - 9.208
NORM2— Euclidean vector norms - 9.209
NOT— Logical negation - 9.210
NULL— Function that returns an disassociated pointer - 9.211
NUM_IMAGES— Function that returns the number of images - 9.212
OR— Bitwise logical OR - 9.213
PACK— Pack an array into an array of rank one - 9.214
PARITY— Reduction with exclusive OR - 9.215
PERROR— Print system error message - 9.216
POPCNT— Number of bits set - 9.217
POPPAR— Parity of the number of bits set - 9.218
PRECISION— Decimal precision of a real kind - 9.219
PRESENT— Determine whether an optional dummy argument is specified - 9.220
PRODUCT— Product of array elements - 9.221
RADIX— Base of a model number - 9.222
RAN— Real pseudo-random number - 9.223
RAND— Real pseudo-random number - 9.224
RANDOM_INIT— Initialize a pseudo-random number generator - 9.225
RANDOM_NUMBER— Pseudo-random number - 9.226
RANDOM_SEED— Initialize a pseudo-random number sequence - 9.227
RANGE— Decimal exponent range - 9.228
RANK— Rank of a data object - 9.229
REAL— Convert to real type - 9.230
RENAME— Rename a file - 9.231
REPEAT— Repeated string concatenation - 9.232
RESHAPE— Function to reshape an array - 9.233
RRSPACING— Reciprocal of the relative spacing - 9.234
RSHIFT— Right shift bits - 9.235
SAME_TYPE_AS— Query dynamic types for equality - 9.236
SCALE— Scale a real value - 9.237
SCAN— Scan a string for the presence of a set of characters - 9.238
SECNDS— Time function - 9.239
SECOND— CPU time function - 9.240
SELECTED_CHAR_KIND— Choose character kind - 9.241
SELECTED_INT_KIND— Choose integer kind - 9.242
SELECTED_REAL_KIND— Choose real kind - 9.243
SET_EXPONENT— Set the exponent of the model - 9.244
SHAPE— Determine the shape of an array - 9.245
SHIFTA— Right shift with fill - 9.246
SHIFTL— Left shift - 9.247
SHIFTR— Right shift - 9.248
SIGN— Sign copying function - 9.249
SIGNAL— Signal handling subroutine (or function) - 9.250
SIN— Sine function - 9.251
SIND— Sine function, degrees - 9.252
SINH— Hyperbolic sine function - 9.253
SIZE— Determine the size of an array - 9.254
SIZEOF— Size in bytes of an expression - 9.255
SLEEP— Sleep for the specified number of seconds - 9.256
SPACING— Smallest distance between two numbers of a given type - 9.257
SPREAD— Add a dimension to an array - 9.258
SQRT— Square-root function - 9.259
SRAND— Reinitialize the random number generator - 9.260
STAT— Get file status - 9.261
STORAGE_SIZE— Storage size in bits - 9.262
SUM— Sum of array elements - 9.263
SYMLNK— Create a symbolic link - 9.264
SYSTEM— Execute a shell command - 9.265
SYSTEM_CLOCK— Time function - 9.266
TAN— Tangent function - 9.267
TAND— Tangent function, degrees - 9.268
TANH— Hyperbolic tangent function - 9.269
THIS_IMAGE— Function that returns the cosubscript index of this image - 9.270
TIME— Time function - 9.271
TIME8— Time function (64-bit) - 9.272
TINY— Smallest positive number of a real kind - 9.273
TRAILZ— Number of trailing zero bits of an integer - 9.274
TRANSFER— Transfer bit patterns - 9.275
TRANSPOSE— Transpose an array of rank two - 9.276
TRIM— Remove trailing blank characters of a string - 9.277
TTYNAM— Get the name of a terminal device. - 9.278
UBOUND— Upper dimension bounds of an array - 9.279
UCOBOUND— Upper codimension bounds of an array - 9.280
UMASK— Set the file creation mask - 9.281
UNLINK— Remove a file from the file system - 9.282
UNPACK— Unpack an array of rank one into an array - 9.283
VERIFY— Scan a string for characters not a given set - 9.284
XOR— Bitwise logical exclusive OR
- 10 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: | ||
| Part I: Invoking GNU Fortran | ||
|---|---|---|
| • Invoking GNU Fortran: | Command options supported by gfortran. |
|
| • Runtime: | Influencing runtime behavior with environment variables. | |
| Part II: Language Reference | ||
| • Fortran standards status: | Fortran 2003, 2008 and 2018 features supported by GNU Fortran. | |
| • Compiler Characteristics: | User-visible implementation details. | |
| • Extensions: | Language extensions implemented by GNU Fortran. | |
| • Mixed-Language Programming: | Interoperability with C | |
| • Coarray Programming: | ||
| • Intrinsic Procedures: | Intrinsic procedures supported by GNU Fortran. | |
| • Intrinsic Modules: | Intrinsic modules supported by GNU Fortran. | |
| • Contributing: | How you can help. | |
| • Copying: | GNU General Public License says how you can copy and share GNU Fortran. | |
| • GNU Free Documentation License: | How you can copy and share this manual. | |
| • Funding: | How to help assure continued work for free software. | |
| • Option Index: | Index of command line options | |
| • Keyword Index: | Index of concepts | |
Next: Introduction, Up: (dir) [Contents][Index]
© Free Software Foundation
Licensed under the GNU Free Documentation License, Version 1.3.
https://gcc.gnu.org/onlinedocs/gcc-10.2.0/gfortran/index.html