g95 project's goal is to create a free, open source Fortran 95 compiler. The code has been donated to the Free Software Foundation for inclusion in GCC, the Gnu Compiler Collection.
G95 is still in a beta state. G95 can compile most fortran 90/95 programs just fine on a wide variety of platforms.
-c Compile only, do not run the linker.
-o Specify the name of the output file, either an object file or the executable.
Multiple source and object files can be specified at once. Fortran files are indicated by names ending in ".f", ".F", ".for", ".FOR", ".f90", ".F90", ".f95", ".F95", ".f03" and ".F03". Multiple source files can be specified. Object files can be specified as well and will be linked to form an executable.
Files ending in uppercase letters are preprocessed with the C preprocessor by default, files ending in lowercase letters are not preprocessed by default.
Files ending in ".f", ".F", ".for", and ".FOR" are assumed to be fixed form source compatible with old f77 files. Files ending in ".f90", ".F90", ".f95", ".F95", ".f03" and ".F03" are assumed to be free source form.
g95 -c hello.f90 Compiles hello.f90 to an object file named hello.o.
g95 hello.f90 Compiles hello.f90 and links it to produce an executable a.out.
g95 -c h1.f90 h2.f90 h3.f90 Compiles multiple source files. If all goes well, object files h1.o, h2.o and h3.o are created.
g95 -o hello h1.f90 h2.f90 h3.f90 Compiles multiple source files and links them together to an executable file named 'hello'.
G95 can handle files that contain C preprocessor constructs.
-cpp Force the input files to be run through the C preprocessor
-no-cpp Prevent the input files from being preprocessed
-Dname[=value] Define a preprocessor macro
-Uname Undefine a preprocessor macro
-E Show preprocessed source only
-Idirectory Append 'directory' to the include and module files search path. Files are searched for in various directories in this order: Directory of the main source file, the current directory, directories specified by -I, directories specified in the G95_INCLUDE_PATH environment variable and finally the system directories.
-traditional Performs traditional C preprocessing (default)
-nontraditional Performs modern C preprocessing
-Wall Enable most warning messages
-Werror Change warnings into errors
-Wextra Enable warning not enabled by -Wall
-Wglobals Cross-check procedure use and definition within the same source file. On by default, use -Wno-globals to disable.
-Wimplicit-none Same as -fimplicit-none
-Wimplicit-interface Warn about using an implicit interface
-Wline-truncation Warn about truncated source lines
-Wmissing-intent Warn about missing intents on format arguments
-Wobsolescent Warn about obsolescent constructs
-Wno=numbers Disable a comma separated list of warning numbers
-Wuninitialized Warn about variables used before initialized. Requires -O2
-Wunused-vars Warn about unused variables
-Wunused-types Warn about unused module types. Not implied by -Wall
-Wunset-vars Warn about unset variables
-Wunused-module-vars Warn about unused module variables. Useful for ONLY clauses
-Wunused-module-procs Warn about unused module procedures. Useful for ONLY clauses
-Wunused-parameter Warn about unused parameters. Not implied by -Wall
-Wprecision-loss Warn about precision loss in implicit type conversions
-fbackslash Interpret backslashes in character constants as escape codes. Use -fno-backslash to treat backslashes literally.
-fd-comment Make D lines executable statements in fixed form.
-fdollar-ok Allow dollar signs in entity names
-fendian= Force the endianness of unformatted reads and writes. The value must be 'big' or 'little'. Overrides environment variables.
-ffixed-form Assume that the source file is fixed form
-ffixed-line-length-132 132 character line width in fixed mode
-ffixed-line-length-80 80 character line width in fixed mode
-ffree-form Assume that the source file is free form
-ffree-line-length-huge Allow very large source lines (10k)
-fimplicit-none Specify that no implicit typing is allowed, unless overridden by explicit IMPLICIT statements
-fintrinsic-extensions Enable g95-specific intrinsic functions even in a -std= mode
-fintrinsic-extensions=proc1,proc2,... Include selected intrinsic functions even in a -std= mode. The list is comma-separated and case insensitive.
-fmod=directory Put module files in directory
-fmodule-private Set default accessibility of module-entities to PRIVATE
-fmultiple-save Allow the SAVE attribute to be specified multiple times
-fone-error Force compilation to stop after the first error.
-ftr15581 Enable the TR15581 allocatable array extensions even in -std=F or -std=f95 modes.
-M Produce a Makefile dependency line on standard output
-std=F Warn about non-F features
-std=f2003 Strict fortran 2003 checking
-std=f95 Strict fortran 95 checking
-i4 Set kinds of integers without specification to kind=4 (32 bits). Default kinds are unchanged.
-i8 Set kinds of integers without specification to kind=8 (64 bits). Default kinds are unchanged.
-r8 Set kinds of reals without kind specifications to double precision
-d8 Implies -i8 and -r8.
Code generation options
-fbounds-check Check array and substring bounds at runtime
-fcase-upper Make all public symbols uppercase
-fleading-underscore Add a leading underscore to public names
-fonetrip Execute DO-loops at least once. (Buggy fortran 66)
-fpack-derived Try to layout derived types as compact as possible. Requires less memory, but may be slower
-fqkind=n Set the kind for a real with the 'q' exponent to n
-fsecond-underscore Append a second trailing underscore in names having an underscore (default). Use -fno-second-underscore to suppress.
-fshort-circuit Cause the .AND. and .OR. operators to not compute the second operand if the value of the expression is known from the first operand.
-fsloppy-char Suppress errors when writing non-character data to character descriptors
-fstatic Put local variables in static memory where possible. This is not the same as linking things statically (-static).
-ftrace '-ftrace=frame' will insert code to allow stack tracebacks on abnormal end of program. This will slow down your program. '-ftrace=full' additionally allows finding the line number of arithmetic exceptions (slower). Default is '-ftrace=none'.
-funderscoring Append a trailing underscore in global names (default). Use -fno-underscoring to suppress.
-max-frame-size=n How large a single stack frame will get before arrays are allocated dynamically
-finteger=n Initialize uninitialized scalar integer variables to n
-flogical= Initialize uninitialized scalar logical variables. Legal values are none, true and false.
-freal= Initialize uninitialized scalar real and complex variables. Legal values are none, zero, nan, inf, +inf and -inf.
-fpointer= Initialize scalar pointers. Legal values are none, null and invalid.
-fround= Controls compile-time rounding. Legal values are nearest, plus, minus and zero. Default is round to nearest, plus is round to plus infinity, minus is minus infinity, zero is towards zero.
-fzero Initialize numeric types to zero, logical values to false and pointers to null. The other initialization options override this one.