11. Compiler Options

Todo: scribed current compiler options and what their purpose is (what was encountered in the past in order for the options to be as they are now?)

  • Release: optimized with -O3 for execution runs

  • Debug: debugger options

  • Sanitize: GNU sanitizer for further debugging

Compiler-Flag

Options,List

What does it do?

–ffpe-trap=list

invalid

invalid floating point operation, such as SQRT(-1.0)

zero

division by zero

overflow

overflow in a floating point operation

underflow

underflow in a floating point. DO NOT USE. Because a small value can occure, such as exp(-766.2). operation

precision

loss of precision during operation

Some of the routines in the Fortran runtime library, like CPU_TIME, are likely to trigger floating point exceptions when ffpe-trap=precision is used. For this reason, the use of ffpe-trap=precision is not recommended.

denormal

operation produced a denormal value

-fbacktrace

runtime error should lead to a backtrace of the error

-fcheck=keyword

all

enable all run-time check

array-temps

Warns at run time when for passing an actual argument a temporary array had to be generated. The information generated by this warning is sometimes useful in optimization, in order to avoid such temporaries.

bounds

Enable generation of run-time checks for array subscripts and against the declared minimum and maximum values. It also checks array indices for assumed and deferred shape arrays against the actual allocated bounds and ensures that all string lengths are equal for character array constructors without an explicit typespec.

do

Enable generation of run-time checks for invalid modification of loop iteration variables

mem

Enable generation of run-time checks for memory allocation. Note: This option does not affect explicit allocations using theALLOCATE statement, which will be always checked.

pointer

Enable generation of run-time checks for pointers and allocatables.

recursion

Enable generation of run-time checks for recursively called subroutines and functions which are not marked as recursive. See also -frecursive. Note: This check does not work for OpenMP programs and is disabled if used together with -frecursiveand -fopenmp.

-fdump-core

Request that a core-dump file is written to disk when a runtime error is encountered on systems that support core dumps. This option is only effective for the compilation of the Fortran main program

-fstack-arrays

Adding this option will make the Fortran compiler put all local arrays, even those of unknown size onto stack memory. If your program uses very large local arrays it is possible that you will have to extend your runtime limits for stack memory on some operating systems. This flag is enabled by default at optimization level -Ofast.

-frepack-arrays

In some circumstances GNU Fortran may pass assumed shape array sections via a descriptor describing a noncontiguous area of memory. This option adds code to the function prologue to repack the data into a contiguous block at runtime.This should result in faster accesses to the array. However it can introduce significant overhead to the function call, especially when the passed data is noncontiguous.

-finline-matmul-limit=n

-finit-local-zero

The -finit-local-zero option instructs the compiler to initialize local INTEGER, REAL, and COMPLEX variables to zero, LOGICALvariables to false, and CHARACTER variables to a string of null bytes