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

GCC

Arm

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

GCC

Arm

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

GCC

Arm

Description

-c

-c

Run only preprocess, compile and assemble steps.

-o filename

-o filename

Write to output filename.

-g

-g

Generate source level debug information.

-Wall

-warn none

-Wall

-w

Enable all warnings.

Suppress all warnings.

-cpp

-nocpp

-cpp

-nocpp

Preprocess Fortran source files.

Do not preprocess Fortran source files.

Note

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.

-fopenmp

-fopenmp

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.

-On

-On

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

See the Optimization options for the Arm Fortran Compiler.

-frealloc-lhs

-fno-realloc-lhs

-frealloc-lhs

-fno-realloc-lhs

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

Note

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.

-byteswapio

-fconvert=big-endian

-fconvert=little-endian

-fconvert=native

-fconvert=swap

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.

Note

Default behavior is native.

-Dmacro=value

-Dmacro=value

Set macro to value.

-Ldirectory

-Ldirectory

Add directory to the include search path.

-llib

-llib

Search for the library lib when linking.

-fdefault-real-8

-r8

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

Unspecified real kinds are evaluated as KIND=8.

-fdefault-integer-8

-i8

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

-frecord-marker=n

N/A

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.

-fpic

-fPIC

-fpic

-fPIC

Generate position independent code.

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

Description

Syntax

Notes

Basic optimization switches

-On

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

-Ofast

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

    -Menable-no-nans

    -Menable-unsafe-fp-math

    -fno-signed-zeros -freciprocal-math

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

    -ffast-math -ffinite-math-only

    -fstack-arrays

  • Unsetting: -fmath-errno

Fused floating-point operations

-ffp-contract=fast/off

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

-ffast-math

-funsafe-math-optimizations

Allows aggressive, lossy, floating-point optimizations.

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

Finite maths

-ffinite-maths-only

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

Extension

Purpose

armflang equivalent

Notes

ISNAN(x)

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

IEEE_IS_NAN(x)

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