Flang Options - Flang Options - 57222

AOCC User Guide

Document_ID
57222
Release_Date
2026-05-12
Revision
5.2 English

Use the following commands to get a list of compiler options.

$flang -help
$flang --help-hidden

The Flang compiler supports all Clang 17.0.1 Compiler Options and the following Flang-specific compiler options.

  • -Kieee

    Enabled by default from AOCC 2.2.0, it instructs the compiler to conform to the IEEE-754 specifications. The compiler will perform floating-point operations in strict conformance with the IEEE 754 standard. Some optimizations are disabled when this option is specified.

  • -no-flang-libs

    Do not link against Flang libraries.

  • -mp

    Enable OpenMP and link with OpenMP library libomp.

  • -nomp

    Do not link with OpenMP library libomp.

  • -Mbackslash

    Treat backslash in quoted strings as any other character.

  • -Mnobackslash

    Treat backslash in quoted strings as a C-style escape character (default).

  • -Mbyteswapio

    Swap byte-order from big-endian to little-endian or vice-versa for unformatted input/output.

  • -Mfixed

    Assume fixed-format source.

  • -Mextend

    Allow source lines up to 132 characters.

  • -Mfreeform

    Assume free-format source.

  • -Mpreprocess

    Run preprocessor for Fortran files.

  • -Mstandard

    Check standard conformance.

  • -Msave

    Assume all variables have SAVE attribute.

  • -module

    Path to module file (-I also works).

  • -Mallocatable=95

    Select Fortran 95 semantics for assignments to allocatable objects (default).

  • -Mallocatable=03

    Select Fortran 03 semantics for assignments to allocatable objects.

  • -static-flang-libs

    Link using static Flang libraries.

  • -M[no]daz

    Treat denormalized numbers as zero.

  • -M[no]flushz

    Set SSE to flush-to-zero mode.

  • -Mcache_align

    Align large objects on cache-line boundaries.

  • -M[no]fprelaxed

    This option is ignored.

  • -fdefault-integer-8

    Treat INTEGER and LOGICAL as INTEGER*8 and LOGICAL*8.

  • -fdefault-real-8

    Treat REAL as REAL*8.

  • -i8

    Treat INTEGER and LOGICAL as INTEGER*8 and LOGICAL*8.

  • -r8

    Treat REAL as REAL*8.

  • -fno-fortran-main

    Do not link in Fortran main.

  • -Mrecursive

    Allocate local variables on the stack thus allowing recursion. Saved, data-initialized, or namelist members are always allocated statically regardless of the setting of this switch.

  • -fdo-concurrent-to-openmp=<host, none>

    Enables/disables parallelization support for Do Concurrent loops by mapping existing Do Concurrent loop to OpenMP constructs. Currently, host and none options are supported. The host option enables parallelization support while the none option disables it.

    Usage

     -fopenmp -fdo-concurrent-to-openmp=host
    -fopenmp -fdo-concurrent-to-openmp=none

    Example

    test.f90:

    program do_concurrent_reduction
      implicit none
      integer :: i
      real :: arr(1000), sum_val
    
      arr = [(real(i), i = 1, 1000)]
      sum_val = 0.0
    
      do concurrent (i = 1:1000) reduce(+:sum_val)
         sum_val = sum_val + arr(i)
      end do
    
      print *, sum_val
    end program do_concurrent_reduction
    flang -fopenmp -fdo-concurrent-to-openmp=host test.f90