You copied the Doc URL to your clipboard.

armflang for gfortran users

The reference versions used in this guide are:

  • GCC (gfortran 8.2.0)

  • Arm® Fortran Compiler

Invoking the compiler

The following table gives the equivalent GCC and Arm Compiler commands to invoke Arm Fortran Compiler for preprocessing, compilation, assembly, and linking.

Invoking the compiler



gfortran <options> <filename>

armflang <options> <filename>

The following table gives the equivalent GCC and Arm Compiler commands to access compiler details and documentation.

Accessing version information and documentation



Version details

gfortran --version

armflang --version

Help and documentation

gfortran --help

man gfortran

armflang --help

man armflang

Commonly used flags

The following table summarizes some of the compiler options most commonly used with GCC and gives the equivalent options to use with the Arm Fortran Compiler:

GCC and Arm Compiler equivalent options






Run only preprocess, compile, and assemble steps.

-o filename

-o filename

Write to output filename.



Generate source level debug information.


-warn none



Enable all warnings.

Suppress all warnings.





Preprocess Fortran source files.

Do not preprocess Fortran source files.


By default, source files with the extensions, .F, .F90, .F95, .F03 and .F08 are preprocessed. -cpp forces the compiler to use the processor for all source files.



Enable OpenMP.

See OpenMP support for Arm Fortran Compiler.

-J path

-I path

-module path

Specifies a directory to place and search for module files.



Level of optimization to use, where n=0,1,2,3.

See the Optimization options for the Arm Fortran Compiler.





-frealloc-lhs uses Fortran 2003 standard semantics for assignments to allocatables. An allocatable object on the left-hand side of an assignment is (re)allocated to match the dimensions of the right-hand side.

-fno-realloc-lhs uses pre-Fortran 2003 standard semantics for assignments to allocatables. The left-hand side of an allocatable assignment is assumed to be allocated with the correct dimensions. Incorrect behavior can occur if the left-hand side is not allocated with the correct dimensions.


Default behavior in armflang versions 19.0+ supports the Fortran 2003 standard feature: (re)allocation on assignment. By default, earlier versions of armflang do not support this feature.






Swap the byte ordering for unformatted file access of numeric data to big-endian from little-endian, or the other way round.

armflang also provides options to set the byte order explicitly to big-endian, little-endian, or native.


Default behavior is native.



Set macro to value.



Add directory to the include search path.



Search for the library lib when linking.



Set the default KIND for real and complex declarations, constants, functions, and intrinsics to 64-bit (such as real (KIND=8)).

Unspecified real kinds are evaluated as KIND=8.



Set the default kind for INTEGER and LOGICAL to 64-bit (KIND=8).



Length of record markers for unformatted files.

n can be 4 or 8. Default is 4. However, older versions of gfortran default to 8.

armflang uses a record marker of length 4 bytes.





Generate Position Independent Code (PIC).

Using the -fpic compiler flag with GCC compilers on AArch64 causes the compiler to generate one less instruction per address computation in the code, and use a Global Offset Table (GOT) limited to 32kiB.

Arm Compiler treats -fpic as equivalent to -fPIC. To increase code portability, Arm recommends using -fPIC when compiling with Arm Compiler.

For more information on the use of -fpic and -fPIC on AArch64, see the Note about building Position Independent Code PIC on AArch64.

Optimization compiler options

The following table summarizes some of the most commonly used compiler options provided by GCC and Arm Fortran Compiler:

Commonly used optimization options




Basic optimization switches


Optimization level where n=0,1,2,3. There is no direct correlation between the optimizations employed at each level between the two compilers.

At n=0, the compiler performs little or no optimization.

At n=3, the compiler performs aggressive optimization.

At n=2 and n=3, debug information might not be satisfactory because the mapping of object code to source code is not always clear and the compiler can perform optimizations that cannot be described in the debug information.

Aggressive optimization


Enables all -O3 optimizations from level 3 and performs aggressive optimization, which can violate strict language compliance.

With armflang, this is equivalent to:

  • Setting: -O3 -Menable-no-infs



    -fno-signed-zeros -freciprocal-math

    -fno-trapping-math -ffp-contract=fast

    -ffast-math -ffinite-math-only


  • Unsetting: -fmath-errno

Fused floating-point operations


Instructs armflang to perform fused floating-point operations, such as fused multiply adds.

  • fast = always on (default for -O1 and above)

  • off = never

Reduced floating-point precision



Allows aggressive, lossy, floating-point optimizations.

Allows reciprocal optimizations and does not honor trapping or signed zero.

Finite maths


Enable optimizations that ignore the possibility of NaNs and Infs.

Language extensions

Some commonly supported language extensions are not supported in armflang:

GCC and Arm Compiler options



armflang equivalent



Logical function returns .TRUE. if the REAL argument x is Not-a-Number (NaN).


Introduced with 2003 standard. Requires IEEE_ARITHMETIC module.

For more information on supported language extensions, see the Fortran intrinsics chapter in the Arm Fortran Compiler Reference Guide.

Fortran formatted I/O

armflang adopts the Linux/UNIX convention of using the line-feed character ('LF', '0x0A', '\n') as the record terminator in formatted I/O, for both read and write operations. However, gfortran also accepts the carriage return character ('CR', '0x0D', '\r') to denote the end of records on read operations. This can lead to differing behavior between armflang and gfortran builds when accessing files containing 'CR' characters, such as text files generated on Windows platforms, which use 'CR-LF' to denote the end of lines.

Was this page helpful? Yes No