Flang command line argument reference



Display the compiler’s target processor


Display the version of the compiler


Specify comma-separated list of triples OpenMP offloading targets to be supported

-fppc-native-vector-element-order, -fno-ppc-native-vector-element-order

Specifies PowerPC native vector element order (default)

-frtlib-add-rpath, -fno-rtlib-add-rpath

Add -rpath with architecture-specific resource directory to the linker flags. When –hip-link is specified, also add -rpath with HIP runtime library directory to the linker flags

-fstack-arrays, -fno-stack-arrays

Attempt to allocate array temporaries on the stack, no matter their size

-fversion-loops-for-stride, -fno-version-loops-for-stride

Create unit-strided versions of loops


Use GCC installation in the specified directory. The directory ends with path components like ‘lib{,32,64}/gcc{,-cross}/$triple/$version’. Note: executables (e.g. ld) used by the compiler are not overridden by the selected GCC installation


Specify a directory where Flang can find ‘lib{,32,64}/gcc{,-cross}/$triple/$version’. Flang will use the GCC installation with the largest version


Link the LLVM C Library for GPUs

-help, --help

Display available options


Display help for hidden options

-mllvm <arg>, -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.


Do not link device library for CUDA/HIP device compilation


Write output to <file>

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

Print the effective target triple

-print-resource-dir, --print-resource-dir

Print the resource directory pathname that contains lib and include directories with the runtime libraries and MODULE files.

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

Print the normalized target triple

-pthread, -no-pthread

Support POSIX threads in generated code

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

Save intermediate compilation results. <arg> can be set to ‘cwd’ for current working directory, or ‘obj’ which will save temporary files in the same directory as the final output file

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

Generate code for the given target


Show commands to run and use verbose output


Print version information


Suppress all warnings


Treat subsequent input files as having type <language>


The action to perform on the input.


Only run the preprocessor


Only run preprocess and compilation steps


Only run preprocess, compile, and assemble steps


Use the LLVM representation for assembler and object files


Run the preprocessor, parser and semantic analysis stages

Compilation options

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

-Xflang <arg>

Pass <arg> to the flang compiler

-moutline-atomics, -mno-outline-atomics

Generate local calls to out-of-line atomic operations

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

Language standard to compile for

Preprocessor options

Flags controlling the behavior of the Flang preprocessor.


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


Disable linemarker output in -E mode


Undefine macro <macro>

Include path management

Flags controlling how #includes are resolved to files.


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


Set the system root directory (usually /)

Dumping preprocessor state

Flags allowing the state of the preprocessor to be dumped in various ways.


Print macro definitions in -E mode instead of normal output

Diagnostic options

Flags controlling which warnings, errors, and remarks Flang will generate. See Clang’s Diagnostic Reference for a full list of warning and remark flags.


Enable the specified remark


Report transformation analysis from optimization passes whose name matches the given POSIX regular expression


Report missed transformations by optimization passes whose name matches the given POSIX regular expression


Report transformations performed by optimization passes whose name matches the given POSIX regular expression


Enable the specified warning

Target-independent compilation options


Enable predefined and command line preprocessor macros

-fPIC, -fno-PIC
-fPIE, -fno-PIE

Enable the old style PARAMETER statement

-fapprox-func, -fno-approx-func

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

-fassociative-math, -fno-associative-math
-fbackslash, -fno-backslash

Specify that backslash in string introduces an escape character

-fcolor-diagnostics, -fno-color-diagnostics

Enable colors in diagnostics


Set endian conversion of data for unformatted files


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


Set the default integer and logical kind to an 8 byte wide type


Set the default real kind to an 8 byte wide type

-ffast-math, -fno-fast-math

Allow aggressive, lossy floating-point optimizations


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


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


Process source files in free form

-fhonor-infinities, -fno-honor-infinities

Specify that floating-point optimizations are not allowed that assume arguments and results are not +-inf.

-fhonor-nans, -fno-honor-nans

Specify that floating-point optimizations are not allowed that assume arguments and results are not NANs.

-fimplicit-none, -fno-implicit-none

No implicit typing allowed unless overridden by IMPLICIT statements


Specify the default character set for source files

-fintegrated-as, -fno-integrated-as

Enable the integrated assembler

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


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

-flogical-abbreviations, -fno-logical-abbreviations

Enable logical abbreviations

-flto=<arg>, -flto (equivalent to -flto=full), -flto=auto (equivalent to -flto=full), -flto=jobserver (equivalent to -flto=full)

Set LTO mode. <arg> must be ‘thin’ or ‘full’.


Specify Visual Studio C runtime library. “static” and “static_dbg” correspond to the cl flags /MT and /MTd which use the multithread, static version. “dll” and “dll_dbg” correspond to the cl flags /MD and /MDd which use the multithread, dll version. <arg> must be ‘static’, ‘static_dbg’, ‘dll’ or ‘dll_dbg’.

-fomit-frame-pointer, -fno-omit-frame-pointer

Omit the frame pointer from functions that don’t need it. Some stack unwinding cases, such as profilers and sanitizers, may prefer specifying -fno-omit-frame-pointer. On many targets, -O1 and higher omit the frame pointer by default. -m[no-]omit-leaf-frame-pointer takes precedence for leaf functions


Enable OpenACC


Parse OpenMP pragmas and generate parallel code.


Force behvaior as if the user specified pragma omp requires unified_shared_memory.

-fopenmp-target-debug, -fno-openmp-target-debug

Enable debugging in the OpenMP offloading device RTL


Set OpenMP version (e.g. 45 for OpenMP 4.5, 51 for OpenMP 5.1). Default value is 11 for Flang


Specify the output name of the file containing the optimization remarks. Implies -fsave-optimization-record. On Darwin platforms, this cannot be used with multiple -arch <arch> options.


Only include passes which match a specified regular expression in the generated optimization record (by default, include all passes)


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

-fpic, -fno-pic
-fpie, -fno-pie
-freciprocal-math, -fno-reciprocal-math

Allow division operations to be reassociated

-fropi, -fno-ropi

Generate read-only position independent code (ARM only)

-frwpi, -fno-rwpi

Generate read-write position independent code (ARM only)

-fsave-optimization-record, -fno-save-optimization-record

Generate a YAML optimization record file


Generate an optimization record file in a specific format

-fsigned-zeros, -fno-signed-zeros
-funderscoring, -fno-underscoring

Appends one trailing underscore to external names


Use the given vector functions library. <arg> must be ‘Accelerate’, ‘libmvec’, ‘MASSV’, ‘SVML’, ‘SLEEF’, ‘Darwin_libsystem_m’, ‘ArmPL’, ‘AMDLIBM’ or ‘none’.

-fxor-operator, -fno-xor-operator

Enable .XOR. as a synonym of .NEQV.


Disable predefined and command line preprocessor macros

-pedantic, --pedantic

Warn on language extensions

Common Offloading options

--offload-arch=<arg>, --no-offload-arch=<arg>

Specify an offloading device architecture for CUDA, HIP, or OpenMP. (e.g. sm_35). If ‘native’ is used the compiler will detect locally installed architectures. For HIP offloading, the device architecture can be followed by target ID features delimited by a colon (e.g. gfx908:xnack+:sramecc-). May be specified more than once.


Only compile for the offloading device.


Compile for both the offloading host and device (default).


Only compile for the offloading host.

HIP options


ROCm installation path, used for finding and automatically linking required bitcode libraries.

Target-dependent compilation options


For a list of available architectures for the target use ‘-mcpu=help’


Specify code object ABI version. Defaults to 5. (AMDGPU only). <arg> must be ‘none’, ‘4’, ‘5’ or ‘6’.


For a list of available CPUs for the target use ‘-mcpu=help’


Defaults to the vector length agnostic value of “scalable”. Accepts power of 2 values between 64 and 65536. Also accepts “zvl” to use the value implied by -march/-mcpu. (RISC-V only)



Specify the size in bits of an SVE vector register. Defaults to the vector length agnostic value of “scalable”. (AArch64 only)

Optimization level

Flags controlling how much optimization should be performed.


Debug information generation

Flags controlling how much and what kind of debug information should be generated.

Kind and level of debug information


Generate source-level debug information

Debug level

Emit debug line info directives only

-gline-tables-only, -g1

Emit debug line number tables only

Linker options

Flags that are passed on to the linker


Add directory to library search path


Pass the comma separated arguments in <arg> to the linker

-rpath <arg>
-shared, --shared
-static, --static