Flang command line argument reference

Introduction

-help, --help, /help<arg>, -help<arg>, --help<arg>

Display available options

-mllvm <arg>

Additional arguments to forward to LLVM’s option processing

-mmlir <arg>

Additional arguments to forward to MLIR’s option processing

-module-dir<dir>, -J<arg>

This option specifies where to put .mod files for compiled modules. It is also added to the list of directories to be searched by an USE statement. The default is the current directory.

-o<file>, /Fo<arg>, -Fo<arg>, --output <arg>, --output=<arg>

Write output to <file>

-print-effective-triple, --print-effective-triple

Print the effective target triple

-print-target-triple, --print-target-triple

Print the normalized target triple

-save-temps=<arg>, --save-temps=<arg>, -save-temps (equivalent to -save-temps=cwd), --save-temps (equivalent to -save-temps=cwd)

Save intermediate compilation results.

--target=<arg>, -target <arg>

Generate code for the given target

--version

Print version information

-x<language>, --language <arg>, --language=<arg>

Treat subsequent input files as having type <language>

Actions

The action to perform on the input.

-E, --preprocess

Only run the preprocessor

-S, --assemble

Only run preprocess and compilation steps

-c, --compile

Only run preprocess, compile, and assemble steps

-emit-llvm

Use the LLVM representation for assembler and object files

-fsyntax-only

Run the preprocessor, parser and semantic analysis stages

Compilation flags

Flags controlling the behavior of Clang during compilation. These flags have no effect during actions that do not perform compilation.

-Xflang <arg>

Pass <arg> to the flang compiler

-std=<arg>, --std=<arg>, --std <arg>

Language standard to compile for

Preprocessor flags

Flags controlling the behavior of the Clang preprocessor.

-D<macro>=<value>, --D<arg>, /D<arg>, -D<arg>, --define-macro <arg>, --define-macro=<arg>

Define <macro> to <value> (or 1 if <value> omitted)

-P, --no-line-commands

Disable linemarker output in -E mode

-U<macro>, --undefine-macro <arg>, --undefine-macro=<arg>

Undefine macro <macro>

Include path management

Flags controlling how #includes are resolved to files.

-I<dir>, /I<dir>, -I<dir>, --include-directory <arg>, --include-directory=<arg>

Add directory to include search path. For C++ inputs, if there are multiple -I options, these directories are searched in the order they are given before the standard system directories are searched. If the same directory is in the SYSTEM include search paths, for example if also specified with -isystem, the -I option will be ignored

Diagnostic flags

Flags controlling which warnings, errors, and remarks Clang will generate. See the full list of warning and remark flags.

-W<warning>, --extra-warnings, --warn-<arg>, --warn-=<arg>

Enable the specified warning

Target-independent compilation options

-cpp

Enable predefined and command line preprocessor macros

-falternative-parameter-statement

Enable the old style PARAMETER statement

-fapprox-func, -fno-approx-func

Allow certain math function calls to be replaced with an approximately equivalent calculation

-fbackslash, -fno-backslash

Specify that backslash in string introduces an escape character

-fcolor-diagnostics, -fdiagnostics-color, -fno-color-diagnostics

Enable colors in diagnostics

-fconvert=<arg>

Set endian conversion of data for unformatted files

-fdefault-double-8

Set the default double precision kind to an 8 byte wide type

-fdefault-integer-8

Set the default integer kind to an 8 byte wide type

-fdefault-real-8

Set the default real kind to an 8 byte wide type

-ffast-math, -fno-fast-math

Allow aggressive, lossy floating-point optimizations

-ffixed-form

Process source files in fixed form

-ffixed-line-length=<arg>, -ffixed-line-length-<arg>

Set column after which characters are ignored in typical fixed-form lines in the source file

-ffp-contract=<arg>

Form fused FP ops (e.g. FMAs): fast (fuses across statements disregarding pragmas) | on (only fuses in the same statement unless dictated by pragmas) | off (never fuses) | fast-honor-pragmas (fuses across statements unless dictated by pragmas). Default is ‘fast’ for CUDA, ‘fast-honor-pragmas’ for HIP, and ‘on’ otherwise. <arg> must be ‘fast’, ‘on’, ‘off’ or ‘fast-honor-pragmas’.

-ffree-form

Process source files in free form

-fimplicit-none, -fno-implicit-none

No implicit typing allowed unless overridden by IMPLICIT statements

-finput-charset=<arg>

Specify the default character set for source files

-fintrinsic-modules-path <dir>
This option specifies the location of pre-compiled intrinsic modules,

if they are not in the default location expected by the compiler.

-flarge-sizes

Use INTEGER(KIND=8) for the result type in size-related intrinsics

-flogical-abbreviations, -fno-logical-abbreviations

Enable logical abbreviations

-fopenacc

Enable OpenACC

-fopenmp, -fno-openmp

Parse OpenMP pragmas and generate parallel code.

-fpass-plugin=<dsopath>

Load pass plugin from a dynamic shared object file (only with new pass manager).

-freciprocal-math, -fno-reciprocal-math

Allow division operations to be reassociated

-fxor-operator, -fno-xor-operator

Enable .XOR. as a synonym of .NEQV.

-nocpp

Disable predefined and command line preprocessor macros

-pedantic, --pedantic, -no-pedantic, --no-pedantic

Warn on language extensions

Optimization level

Flags controlling how much optimization should be performed.

-Ofast<arg>