Fortran 90 Compiler

  

Fortran 90 Compiler

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.

  1. An Introduction to Fortran 90 10 Fortran 90 student notes 1.2 ANSI Standard Fortran 90 is a superset of Fortran 77, that is programs written in Fortran 77 may be compiled and run as Fortran 90 programs. However Fortran 90 is more than a new release of Fortran 77. The Fortran 90 standard introduces many new facilities for array.
  2. On HP Exemplar systems, HP Fortran 90 supports CXpa for enhanced tuning of parallel computing. Included with HP Fortran 90 is an ANSI/ISO-compliant Fortran 90 compiler, as well as debugger, performance analyzer, incremental linker and programming utilities. Both workstation and HP 9000 server user licenses are priced at $1,495 per user license.

2.2 Options controlling Fortran dialect

The following options control the details of the Fortran dialectaccepted by the compiler:

-ffree-form
-ffixed-form

Specify 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-intrinsics

This 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-mismatch

Some 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-boz

A 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-comments

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

-fdec

DEC 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-conversions

Enable the use of character literals in assignments and DATA statementsfor non-character variables.

-fdec-structure

Enable 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-ints

Enable 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-math

Enable legacy math intrinsics such as COTAN and degree-valued trigonometricfunctions (e.g. TAND, ATAND, etc...) for compatability with older code.

-fdec-static

Enable DEC-style STATIC and AUTOMATIC attributes to explicitly specifythe storage of variables and other objects.

-fdec-include
Fortran 90 compiler linux

Enable 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-defaults

Enable format specifiers F, G and I to be used without width specifiers,default widths will be used instead.

-fdec-blank-format-item

Enable a blank format item at the end of a format specification i.e. nothingfollowing the final comma.

-fdollar-ok

Allow ‘$’ 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.

-fbackslash

Change 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-private

Set the default accessibility of module entities to PRIVATE.Use-associated entities will not be accessible unless they are explicitlydeclared as PUBLIC.

-ffixed-line-length-n

Set 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-source

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

Fortran 90 Compiler Windows

-ffree-line-length-n

Set 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=n

Specify the maximum allowed identifier length. Typical values are31 (Fortran 95) and 63 (Fortran 2003 and Fortran 2008).

-fimplicit-none

Specify 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-pointer

Fortran 90 Compiler

Enable the Cray pointer extension, which provides C-like pointerfunctionality.

-fopenacc

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

-fopenmp

Enable 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-8

Set 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-8

Set 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-10

Set 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-16

Set 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-8

Set 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-8

Promote 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-16

Promote 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=std

Specify 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-temp

Enhance test coverage by forcing most forall assignments to use temporary.

Next: Preprocessing Options, Previous: Option Summary, Up: Invoking GNU Fortran [Contents][Index]

Fortran is one of the earliest imperative computer programming languages around. It is often used for scientificand numeric programs. This page lists free Fortran compilers for various operating systems. Note that the differentsoftware listed are compliant with different Fortran standards, eg, ANSI Fortran 77, Fortran 95, Fortran 2003,Fortran 2008, Fortran 2018, and so on, so be sure to get the appropriate one for your purpose. Some of them may alsocome complete with debuggers,editors and anintegrated development environment (IDE).

Related Pages

  • How to Register Your Own Domain Name - get one for your software
  • How to Make Money From Your Website - monetize your software/site

Free Fortran Compilers and IDEs

Flang

Flang is the Fortran compiler front end of the LLVM project (which also includes other compilers, suchas a C/C++ compiler).The current version (as at the date this was written) implements Fortran 2003 (with some features fromFortran 2008), while the next version (currently foundhere) implements Fortran 2018.The link above leads to the source code for the compiler. Thedownloadable binaries (ie, executables)can be found here. Note that the binaries are for Linux (both x86-64 and OpenPOWER) only, although work ona Windows port has begun.

AOCC Fortran

The AMD Optimizing C/C++ Compiler Suite (or 'AOCC') includes an optimizing Fortran compiler that can generate code for32-bit and 64-bit Linux systems. It also comes with optimized libraries.

MinGW'S G77 (GNU Fortran)

Fortran 90 Compiler For Windows 10

This system comes with the GNU G77 Fortran compiler (among other things, including aC/C++ compiler), which you can use to generate Win32 executables fromF77 code. Like many systems based on the GNU tools, Mingw32 comes with complete with various programming tools,such as a program maintainence program (ie, make), text processing tools (sed, grep),lexical analyser generator (flex), parser generator (bison), etc.

Gfortran - the GNU Fortran Compiler

gfortran, part of the GNU Compiler Collection, is a free Fortran 95/2003/2008 compiler. Like all things from GNU, it comeswith source code. Precompiled binaries (executables) are available for Windows, Linux, Mac OS X, the old Mac OS (PPC), etc.

Silverfrost FTN95 Personal Edition

Silverfrost FTN95 is a Fortran 95 compiler that supports Fortran 77, Fortran 90 and Fortran 95. The compiler generates32-bit and 64-bit exectuables for Windows and the Microsoft .NET framework. It comes with CHECKMATE,a tool that lets programmers check the correctness of their code at runtime. Also included is Plato 3 (an IDE),full source level debugging, documentation and examples. You may only generate code for your personal use on yourhome computer, and all executables will display a banner on execution.

Open Source Watcom / OpenWatcom Fortran Compiler

The Watcom (now OpenWatcom) Fortran 77 compiler is now available free of charge, complete with source code.This compiler, which generates code for Win32, Windows 3.1 (Win16), OS/2, Netware, MSDOS(16 and 32 bit), etc, was a well-known compiler some years back (until Sybase terminated it).

G95

[Update (17 November 2020): their website does not seem to be working correctly, withonly a partial change log on the main page, and no links to the compiler or anything else. I'm not sure ifthis is just a temporary situation (eg, due to an error in their web server configuration, such as failing toinstall PHP, since there are fragments of PHP code on the page), or if the site has really gone.]
G95 is an open source Fortran 95 compiler. At the time this was written, most of the ISO Fortran 95 standardhas been implemented. Platforms supported include Linux(x86, Intel IA64, AMD x86_64), Windows, Macintosh OS X, FreeBSD,Sparc Solaris and HP-UX.

Oracle Developer Studio

The Oracle Developer Studio includes C, C++ and Fortran compilers for Linux (specifically the Red Hat and Oracledistributions) andSolaris. Based on information displayed on the download page at the date this entry was written, it looks like you canfreely use the compiler for developing commercial applications if you wish. (As with all software, you should of courseverify this yourself, since the situation sometimes changes over time.)

f2j - Fortran to Java Compiler

f2j translates Fortran 77 source code to Java class files. It is distributed under theGNU GPL and runs on Linux, SunOS/Solaris.

F2C - Fortran to C Translator

This is a well-known Fortran to C converter that comes with source code. The site alsoincludes pre-compiled binaries (executables) for MSDOS and Microsoft Windows, althoughthese are by no means the only systems supported - the compiler works on Unix systems likeBSD, Linux, etc. You have to compile the compiler yourself on those systems.Libraries containing the runtime support needed (together with the C source code)are also included. You need a C compiler to generatebinaries from your Fortran sources.

DJGPP GNU G77 (Fortran 77) for MSDOS

This is a development system based on the well-known GNU compiler system that includes compilers for Fortran 77,C, C++, Objective C, etc.It generates 32 bit MSDOS executables that is Windows 95 long-filename-aware. It is a very complete system with IDEs,graphics libraries,lexical analyser generators (flex), parser generators (bison),text processing utilities (like grep, sed),a program maintainence utility (ie, make),a DOS extender, and so on. The compiler,utilities and libraries come with source code.

Fortran 90 Compiler For Mac

  • How to Register Your Own Domain Name - how to get your own domain name

It will appear on your page as: