To: J3 J3/26-175 From: Mark LeAir Subject: Flang Liaison Report Date: 2026-June-14 #Reference: 26-117r1 Flang Open Source Fortran Report ================================ Flang is an open-source compiler for Fortran. It is an official subproject of the LLVM Project (llvm.org). NVIDIA's portion of the work was partially sponsored by the US Department of Energy Exascale Computing Project (particularly, LLNL, Sandia and LANL). The current goals of the project are to - Create an open source Fortran compiler with LLVM licensing, - that can be used for language and parallelization experimentation, - that exists as a peer in the LLVM community of languages, like Clang, - that can rely on LLVM code generation and parallelism support for CPUs and GPUs. There is a Slack workspace for Flang and a number of conference calls related to Flang development. - Flang biweekly sync call ("umbrella call") - Flang biweekly technical call - "Classic Flang" biweekly call - OpenMP in Flang Technical Call Details can be found on the Getting Involved page http://flang.llvm.org/docs/GettingInvolved.html. The New LLVM Flang Compiler --------------------------- The LLVM Fortran compiler is available at https://github.com/llvm/llvm-project (the LLVM monorepo) in the flang/ directory. LLVM Flang is being developed under the Apache 2.0 license with LLVM exceptions (the same as LLVM, Clang, OpenMP, etc.). New features added between 11-February-2026 and 11-June-2026: (Updates provided by Jean Perier) + Treat REAL(2) and COMPLEX(2) as C-interoperable types, with c_float16 and c_float16_complex in ISO_C_BINDING + Extension: accept '!' as a value separator in NAMELIST input (e.g. name=value!comment) + Added -frelaxed-c-loc-checks to relax some semantic constraints on C_LOC (usable more like LOC) + Added extension to allow multiple program units on the same line (semicolon-separated) Improvements to existing features added between 11-February-2026 and 11-June-2026: (Updates provided by Jean Perier) - Preprocessor: + Recognize compiler directives after expansion in comment (re-landed after fixing continuation-line issues). + Handle semicolons uniformly in program unit constructs. - Semantic checks: + Break recursion on illegal recursive type in defined I/O checking. + Better error for ALLOCATED() applied to a pointer. + Catch recursive call to non-recursive ENTRY. + Catch empty nested parenthesized format item lists. + Warn about assumed-rank items in I/O lists and catch more invalid assumed-rank actual argument uses. + Ignore -fno-realloc-lhs for polymorphic allocatable LHS with a warning. + Downgrade misplaced IGNORE_TKR directive from error to warning. + Clean up -frelaxed-c-loc-checks warning flag handling. + Fail more gracefully when reading a corrupt module file. + Improve generic resolution and missing-expression error messages. + Fixed missing definitions for array named constants from iso_fortran_env (e.g. character_kinds) - IO + Fix EXECUTE_COMMAND_LINE() on Windows, status management, and CMDMSG output padding. + Catch EOSHIFT ARRAY/BOUNDARY type mismatch at runtime. + Catch asynchronous parent or child I/O misuse. + Conditionally fail empty ALLOCATE. + Emit "Infinity" rather than "Inf" when the output format requires it. + Don't mis-parse 1X or X edit descriptors when unparsing format strings. - Driver + -fdisable-real-10 now affects only user code, not the runtime library. Codegen: + Disable copy-out to INTENT(IN) actual arguments passed through to other calls. + Fix WHERE self-updates on allocatable array sections. + Avoid introducing iteration dependencies in WHERE and FORALL temporaries. + Improve array section analysis for WHERE. + DO WHILE loops are now lowered to scf.while by default. + Inline MAX/MINVAL according to -ffp-maxmin-behavior (integer reductions use native min/max ops). + Inline trivial scalar allocatable assignments without runtime calls. + Only instantiate required symbols from parent modules, reducing compile time for large projects. + Preserve logical constant representation through TRANSFER. + Fix IGNORE_TKR(C) passing a descriptor instead of a base address for non-descriptor dummies. + Lower AINT with math.round. + Canonicalize array coordinate operations for contiguous arrays and array sections. + Improved alias analysis (declaration scoping, OPTIONAL handling, volatile casts, derived component accesses). + Continued loop invariant code motion improvements (nested regions, generic allocations). + Preserve UseErrorDetails in module files for clearer USE-associated error messages. + Improved debug info at -g and O0 by keeping argument values visible to the debugger. + Fix source locations reported for WHERE constructs. + Apply vectorization cost model even when IVDEP is present. + Removed legacy non-HLFIR lowering; HLFIR is now the only lowering path. Summary The current state of the LLVM Flang compiler: - written in modern C++ following LLVM conventions - over 200,000 lines of code, tests and scripts - parses all of Fortran 2018 to abstract syntax trees (AST) - parses OpenMP 4.5, some OpenMP 5.0, and some OpenMP 6.0. - parses OpenACC 3.0 - defines a "Fortran Intermediate Representation" (FIR) based on LLVM's MLIR - can analyze most OpenMP and OpenACC constructs - can compile and correctly run Fortran 77 programs (passes FCVS test suite), nearly all Fortran 95 programs, and many programs that use Fortran 2003+ modern features. - supports end-to-end compilation of all OpenMP 1.1 except for reduction, privatization, and one atomic construct. - for later versions of OpenMP, Flang has support for simd, task, taskgroup etc. Classic Flang Compiler ---------------------- The previous version of Flang, now known as Classic Flang, is derived from the PGI Fortran compiler, with some proprietary features removed (e.g., OpenACC support, Interprocedural Analysis). It is the basis for commercial Fortran compilers from AMD and Huawei. Previous commercial versions of the Arm Fortran compiler also used Classic Flang as its basis. Commercial Arm Fortran compilers are now based on LLVM Flang. Classic Flang is available for Linux on x86-64, OpenPOWER, and Arm processors. Also, experimental support for RISCV is available. OpenPower support is not currently being maintained but it is still available. More information is available at https://github.com/flang-compiler/flang.