You copied the Doc URL to your clipboard.

armflang for pgfortran users

The reference versions used in this guide are:

  • PGI Fortran Compiler 18.5

  • Arm® Fortran Compiler

Invoking the compiler

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

Invoking the compiler



pgfortran <options> <filename>

armflang <options> <filename>

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

Accessing version information and documentation



Version details

pgfortran --version

armflang --version

Help and documentation

pgfortran --help

man pgFortran

armflang --help

man armflang

Commonly used flags

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

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







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.

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

  • In version 19.0 of armflang, -Mallocatable=03 and -Mallocatable=95 are supported instead of -frealloc-lhs and -fno-realloc-lhs, respectively. The -Mallocatable option remains supported in the armflang, but from versions 19.3+ the documentation refers to the -frealloc-lhs and -fno-realloc-lhs nomenclature.






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





Generate Position Independent Code (PIC).

Arm Compiler and PGI both treat -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 the PGI 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.