Next: Preprocessing Options, Previous: Option Summary, Up: Invoking GNU Fortran [Contents][Index]
Fortran 90/95 Programming Manual It is assumed that you have access to a computer with a Fortran 90 or Fortran 95 compiler. It is strongly recommended to switch on the compiler flag that warns when the compiler encounters source code that does not conform to the Fortran 90 standard, and the flag that shows warning messages. Fortran 90 compiler? Does anyone know if there is a fortran 90 compiler available and free for SUSE 10.0? The installation cd contains only an old version f77.
2.2 Options controlling Fortran dialect
The following options control the details of the Fortran dialectaccepted by the compiler:
-ffree-form-ffixed-formSpecify the layout used by the source file. The free form layoutwas introduced in Fortran 90. Fixed form was traditionally used inolder Fortran programs. When neither option is specified, the sourceform is determined by the file extension.
-fall-intrinsicsThis option causes all intrinsic procedures (including the GNU-specificextensions) to be accepted. This can be useful with -std=f95 toforce standard-compliance but get access to the full range of intrinsicsavailable with gfortran. As a consequence, -Wintrinsics-stdwill be ignored and no user-defined procedure with the same name as anyintrinsic will be called except when it is explicitly declared EXTERNAL.
-fallow-argument-mismatchSome code contains calls to external procedures with mismatchesbetween the calls and the procedure definition, or with mismatchesbetween different calls. Such code is non-conforming, and will usuallybe flagged with an error. This options degrades the error to awarning, which can only be disabled by disabling all warnings via-w. Only a single occurrence per argument is flagged by thiswarning. -fallow-argument-mismatch is implied by-std=legacy.
Using this option is strongly discouraged. It is possible toprovide standard-conforming code which allows different types ofarguments by using an explicit interface and TYPE(*).
-fallow-invalid-bozA BOZ literal constant can occur in a limited number of contexts instandard conforming Fortran. This option degrades an error conditionto a warning, and allows a BOZ literal constant to appear where theFortran standard would otherwise prohibit its use.
-fd-lines-as-code-fd-lines-as-commentsEnable special treatment for lines beginning with d or Din fixed form sources. If the -fd-lines-as-code option isgiven they are treated as if the first column contained a blank. If the-fd-lines-as-comments option is given, they are treated ascomment lines.
-fdecDEC compatibility mode. Enables extensions and other features that mimicthe default behavior of older compilers (such as DEC).These features are non-standard and should be avoided at all costs.For details on GNU Fortran’s implementation of these extensions see thefull documentation.
Other flags enabled by this switch are:-fdollar-ok-fcray-pointer-fdec-char-conversions-fdec-structure-fdec-intrinsic-ints-fdec-static-fdec-math-fdec-include-fdec-blank-format-item-fdec-format-defaults
If -fd-lines-as-code/-fd-lines-as-comments are unset, then-fdec also sets -fd-lines-as-comments.
-fdec-char-conversionsEnable the use of character literals in assignments and DATA statementsfor non-character variables.
-fdec-structureEnable DEC STRUCTURE and RECORD as well as UNION,MAP, and dot (’.’) as a member separator (in addition to ’%’). This isprovided for compatibility only; Fortran 90 derived types should be usedinstead where possible.
-fdec-intrinsic-intsEnable B/I/J/K kind variants of existing integer functions (e.g. BIAND, IIAND,JIAND, etc...). For a complete list of intrinsics see the full documentation.
-fdec-mathEnable legacy math intrinsics such as COTAN and degree-valued trigonometricfunctions (e.g. TAND, ATAND, etc...) for compatability with older code.
-fdec-staticEnable DEC-style STATIC and AUTOMATIC attributes to explicitly specifythe storage of variables and other objects.
-fdec-includeEnable parsing of INCLUDE as a statement in addition to parsing it asINCLUDE line. When parsed as INCLUDE statement, INCLUDE does not have tobe on a single line and can use line continuations.
-fdec-format-defaultsEnable format specifiers F, G and I to be used without width specifiers,default widths will be used instead.
-fdec-blank-format-itemEnable a blank format item at the end of a format specification i.e. nothingfollowing the final comma.
-fdollar-okAllow ‘$’ as a valid non-first character in a symbol name. Symbols that start with ‘$’ are rejected since it is unclear which rules toapply to implicit typing as different vendors implement different rules.Using ‘$’ in IMPLICIT statements is also rejected.
-fbackslashChange the interpretation of backslashes in string literals from a singlebackslash character to “C-style” escape characters. The followingcombinations are expanded a, b, f, n,r, t, v, , and 0 to the ASCIIcharacters alert, backspace, form feed, newline, carriage return,horizontal tab, vertical tab, backslash, and NUL, respectively.Additionally, xnn, unnnn andUnnnnnnnn (where each n is a hexadecimal digit) aretranslated into the Unicode characters corresponding to the specified codepoints. All other combinations of a character preceded by areunexpanded.
-fmodule-privateSet the default accessibility of module entities to PRIVATE.Use-associated entities will not be accessible unless they are explicitlydeclared as PUBLIC.
-ffixed-line-length-nSet column after which characters are ignored in typical fixed-formlines in the source file, and, unless -fno-pad-source, through whichspaces are assumed (as if padded to that length) after the ends of shortfixed-form lines.
Popular values for n include 72 (thestandard and the default), 80 (card image), and 132 (correspondingto “extended-source” options in some popular compilers).n may also be ‘none’, meaning that the entire line is meaningfuland that continued character constants never have implicit spaces appendedto them to fill out the line.-ffixed-line-length-0 means the same thing as-ffixed-line-length-none.
-fno-pad-sourceBy default fixed-form lines have spaces assumed (as if padded to that length)after the ends of short fixed-form lines. This is not done either if-ffixed-line-length-0, -ffixed-line-length-none orif -fno-pad-source option is used. With any of those optionscontinued character constants never have implicit spaces appendedto them to fill out the line.
-ffree-line-length-nSet column after which characters are ignored in typical free-formlines in the source file. The default value is 132.n may be ‘none’, meaning that the entire line is meaningful.-ffree-line-length-0 means the same thing as-ffree-line-length-none.
-fmax-identifier-length=nSpecify the maximum allowed identifier length. Typical values are31 (Fortran 95) and 63 (Fortran 2003 and Fortran 2008).
-fimplicit-noneSpecify that no implicit typing is allowed, unless overridden by explicitIMPLICIT statements. This is the equivalent of addingimplicit none to the start of every procedure.
-fcray-pointerEnable the Cray pointer extension, which provides C-like pointerfunctionality.
Fortran 90 Compiler Online
-fopenaccEnable the OpenACC extensions. This includes OpenACC !$accdirectives in free form and c$acc, *$acc and!$acc directives in fixed form, !$ conditionalcompilation sentinels in free form and c$, *$ and!$ sentinels in fixed form, and when linking arranges for theOpenACC runtime library to be linked in.
-fopenmpEnable the OpenMP extensions. This includes OpenMP !$omp directivesin free formand c$omp, *$omp and !$omp directives in fixed form,!$ conditional compilation sentinels in free formand c$, *$ and !$ sentinels in fixed form, and when linking arranges for the OpenMP runtime library to be linkedin. The option -fopenmp implies -frecursive.
-fno-range-check
Disable range checking on results of simplification of constantexpressions during compilation. For example, GNU Fortran will givean error at compile time when simplifying a = 1. / 0.With this option, no error will be given and a will be assignedthe value +Infinity. If an expression evaluates to a valueoutside of the relevant range of [-HUGE():HUGE()],then the expression will be replaced by -Inf or +Infas appropriate.Similarly, DATA i/Z'FFFFFFFF'/ will result in an integer overflowon most systems, but with -fno-range-check the value will“wrap around” and i will be initialized to -1 instead.
-fdefault-integer-8Set the default integer and logical types to an 8 byte wide type. This optionalso affects the kind of integer constants like 42. Unlike-finteger-4-integer-8, it does not promote variables with explicitkind declaration.
-fdefault-real-8Set the default real type to an 8 byte wide type. This option also affectsthe kind of non-double real constants like 1.0. This option promotesthe default width of DOUBLE PRECISION and double real constantslike 1.d0 to 16 bytes if possible. If -fdefault-double-8is given along with fdefault-real-8, DOUBLE PRECISIONand double real constants are not promoted. Unlike -freal-4-real-8,fdefault-real-8 does not promote variables with explicit kinddeclarations.
-fdefault-real-10Set the default real type to an 10 byte wide type. This option also affectsthe kind of non-double real constants like 1.0. This option promotesthe default width of DOUBLE PRECISION and double real constantslike 1.d0 to 16 bytes if possible. If -fdefault-double-8is given along with fdefault-real-10, DOUBLE PRECISIONand double real constants are not promoted. Unlike -freal-4-real-10,fdefault-real-10 does not promote variables with explicit kinddeclarations.

-fdefault-real-16Set the default real type to an 16 byte wide type. This option also affectsthe kind of non-double real constants like 1.0. This option promotesthe default width of DOUBLE PRECISION and double real constantslike 1.d0 to 16 bytes if possible. If -fdefault-double-8is given along with fdefault-real-16, DOUBLE PRECISIONand double real constants are not promoted. Unlike -freal-4-real-16,fdefault-real-16 does not promote variables with explicit kinddeclarations.
-fdefault-double-8Set the DOUBLE PRECISION type and double real constantslike 1.d0 to an 8 byte wide type. Do nothing if thisis already the default. This option prevents -fdefault-real-8,-fdefault-real-10, and -fdefault-real-16,from promoting DOUBLE PRECISION and double real constants like1.d0 to 16 bytes.
-finteger-4-integer-8Promote all INTEGER(KIND=4) entities to an INTEGER(KIND=8)entities. If KIND=8 is unavailable, then an error will be issued.This option should be used with care and may not be suitable for your codes.Areas of possible concern include calls to external procedures,alignment in EQUIVALENCE and/or COMMON, generic interfaces,BOZ literal constant conversion, and I/O. Inspection of the intermediaterepresentation of the translated Fortran code, produced by-fdump-tree-original, is suggested.
-freal-4-real-8-freal-4-real-10-freal-4-real-16-freal-8-real-4-freal-8-real-10-freal-8-real-16Promote all REAL(KIND=M) entities to REAL(KIND=N) entities.If REAL(KIND=N) is unavailable, then an error will be issued.The -freal-4- flags also affect the default real kind and the-freal-8- flags also the double-precision real kind. All otherreal-kind types are unaffected by this option. The promotion is alsoapplied to real literal constants of default and double-precision kindand a specified kind number of 4 or 8, respectively.However, -fdefault-real-8, -fdefault-real-10,-fdefault-real-10, and -fdefault-double-8 take precedencefor the default and double-precision real kinds, both for real literalconstants and for declarations without a kind number.Note that for REAL(KIND=KIND(1.0)) the literal may get promoted andthen the result may get promoted again.These options should be used with care and may not be suitable for yourcodes. Areas of possible concern include calls to external procedures,alignment in EQUIVALENCE and/or COMMON, generic interfaces,BOZ literal constant conversion, and I/O and calls to intrinsic procedureswhen passing a value to the kind= dummy argument. Inspection of theintermediate representation of the translated Fortran code, produced by-fdump-fortran-original or -fdump-tree-original, is suggested.
-std=stdSpecify the standard to which the program is expected to conform,which may be one of ‘f95’, ‘f2003’, ‘f2008’,‘f2018’, ‘gnu’, or ‘legacy’. The default value forstd is ‘gnu’, which specifies a superset of the latestFortran standard that includes all of the extensions supported by GNUFortran, although warnings will be given for obsolete extensions notrecommended for use in new code. The ‘legacy’ value isequivalent but without the warnings for obsolete extensions, and maybe useful for old non-standard programs. The ‘f95’,‘f2003’, ‘f2008’, and ‘f2018’ values specify strictconformance to the Fortran 95, Fortran 2003, Fortran 2008 and Fortran2018 standards, respectively; errors are given for all extensionsbeyond the relevant language standard, and warnings are given for theFortran 77 features that are permitted but obsolescent in laterstandards. The deprecated option ‘-std=f2008ts’ acts as an alias for‘-std=f2018’. It is only present for backwards compatibility withearlier gfortran versions and should not be used any more.
-ftest-forall-tempEnhance test coverage by forcing most forall assignments to use temporary.
Next: Preprocessing Options, Previous: Option Summary, Up: Invoking GNU Fortran [Contents][Index]
Fortran has over a dozen open source and commercial compilers.
Open source compilers
GNU Fortran Compiler
GNU Fortran Compiler (gfortran) is a maturefree and open source compiler, part of the GNU Compiler Collection.
OpenCoarrays is a library and compiler wrapperaround gfortran which enables the parallel programming features of Fortran 2018with gfortran.
LLVM Flang
Flangis a new front-end for Fortran 2018 that has been recentlyadded to LLVM.It is implemented in modern C++ and uses a Fortran-oriented MLIR dialect for lowering to LLVM IR.This project is under active development.
Current Flang
Flang is an open source compilerbased on the NVIDIA/PGI commercial compiler.
LFortran
LFortran is a modern, interactive, LLVM-based Fortrancompiler.
Commercial compilers
Intel
Intel oneAPIis Intel’s suite of compilers, tools, and libraries for Fortran, C, C++, andPython. Intel oneAPI HPC Toolkit providestwo Fortran compilers:
- Intel Fortran Compiler Classic (
ifort), a mature compilerwith full Fortran 2018 support; and - Intel Fortran Compiler Beta (
ifx), a new, LLVM-based compilerthat supports Fortran 95 and partially newer versions of the standard.
Intel oneAPI is available for free.Currently the compiler supports Linux, MacOS and Windows platforms and x86_64 architectures.Community support is available for the free version at the Intel Developer forum.
NAG
The latest NAG Fortran Compilerrelease (7.0) has extensive support for legacy and modern Fortran features including parallel programming with coarrays, as well as additional support for programming with OpenMP.
The Compiler also provides significant support for Fortran 2018 (atomicoperations, events and tasks, plus other smaller features), almost all ofFortran 2008, complete coverage of Fortran 2003, and all of OpenMP 3.1. Allplatforms include supporting tools for software development: source filepolishers, dependency generator for module and include files, call-graphgenerator, interface builder and a precision unifier.
NVIDIA
The NVIDIA HPC SDK C, C++, and Fortran compilers, former PGI compilers, support GPU acceleration of HPC modeling and simulation applications with standard C++ and Fortran, OpenACC® directives, and CUDA®. GPU-accelerated math libraries maximize performance on common HPC algorithms, and optimized communications libraries enable standards-based multi-GPU and scalable systems programming.
NVHPC compilers are available free of charge.Currently the compiler supports Linux platforms and x86_64, ppc64le and aarch64 architectures.Community support is available at the HPC compiler forum.
HPE / Cray
The Cray Compiling Environment (CCE)is the cornerstone innovation of Cray’s adaptive computing paradigm. CCE buildson a well-developed and sophisticated Cray technology base that identifiesregions of computation that are either sequential scalar, vector parallel orhighly multithreaded. It includes optimizing compilers that automaticallyexploit the scalar, vector and multithreading hardware capabilities of the Craysystem. CCE supports Fortran, C and C++.
IBM
IBM® XL Fortranfor Linux is an industry standards-based programming tool used to develop largeand complex applications in the Fortran programming language. It generates codethat leverages the capabilities of the latest POWER9 architecture and maximizesyour hardware utilization. IBM XL Fortran for Linux optimizes yourinfrastructure on IBM Power Systems™ in support of extensive numerical,scientific and high-performance computing.
A community edition of the IBM XL compilers are available free of charge.The compilers support Linux and AIX platforms and ppc64le architectures.
AMD
The AMD Optimizing C/C++ Compiler (AOCC)compiler system is a high performance, production quality code generation tool.The AOCC environment provides various options to developers when building andoptimizing C, C++, and Fortran applications targeting 32-bit and 64-bit Linux®platforms. The AOCC compiler system offers a high level of advancedoptimizations, multi-threading and processor support that includes globaloptimization, vectorization, inter-procedural analyses, loop transformations,and code generation. AMD also provides highly optimized libraries, which extractthe optimal performance from each x86 processor core when utilized. The AOCCCompiler Suite simplifies and accelerates development and tuning for x86applications.
The AOCC compilers are available free of charge and support Linux platforms with x86_64 architectures.
ARM
Linux user-space Fortran compiler.Tailored for HPC and scientific codes, with support for popular Fortran andOpenMP standards and tuned for leading server-class Arm-based platforms. Builton the open source Flang front-end, and the LLVM‑based optimization and codegeneration back-end. Available as part of the Arm Compiler for Linux package.
Absoft
Absoft compilers include Pro Fortrandelivering Absoft’s exclusive AP load balancing, AVX, OpenMP 3.1,extended Fortran 95 compiler with F2003 and F2008 features, FX3 graphical debugger,native tool suite integration, AMDAL HPC scientific and engineering library, and more.Pro Fortran includes Fast Data Visualization, an Absoft exclusive technology forgraphical rendering and data output.
Oracle / Sun
Oracle C, C++, Fortran Compileris highly optimized for Oracle systems, on-premise and in the cloud
- Advanced code generation technology for the latest Oracle SPARC and x86 based systems
- Support for the latest industry standards, including C++14, C++11, C11 and OpenMP 4.0 and extensive GCC compatibility features
- Automatic code analysis during compilation and automatic stack overflow protection at application runtime
Lahey / Fujitsu
LF Professional v7.8 combines the 32/64-bit LGF Rainier compiler with the classicLahey/Fujitsu LF95 compiler. LGF Rainier has full Fortran95/90/77 compliance with extensive support for the Fortran 2003 and 2008 standards.Lahey/Fujitsu LF95 offers best in class diagnostics.Includes the automatic-parallelizing GFortran compiler, Lahey/Fujitsu Fortran 95compiler, Visual Studio Fortran support, Winteracter WiSK Graphics package, and more.
Silverfrost FTN95
Silverfrost FTN95 is a full Fortran 95 standardscompliant compiler, capable of producing fast executables for Win32 and forMicrosoft .NET. FTN95 ships with the world’s best runtime checking and a greatrange of supporting software. All standard and many vendor-specific legacylanguage features are supported, so that Fortran projects may be any combinationof Fortran 77, Fortran 90 and Fortran 95.
NEC
The Fortran compilerconforms to the Fortran-2003 standard (ISO/IEC 1539-1:2004) and supports manyfeatures from Fortran-2008 (ISO/IEC 1539-1:2010).
Fortran 90 Compiler Ubuntu
Discontinued
The following is a list of Fortran compilers that seem discontinued, so we donot list them above:
- Apogee
- Edinburgh Portable Compilers
- Hewlett Packard
- Watcom
- PathScale
- G95
- Open64
- Unisys
Note
Please let us know if there is any compiler that is not listed, or if we listeda compiler in the Discontinued section and it is in fact actively maintained.