# Classic Flang is not the Flang inside LLVM

> flang-compiler/flang is the out-of-tree Fortran front end built on LLVM, a descendant of pgfortran that AMD, Arm and Huawei ship in their compilers. It still builds and still exposes a Clang-style driver, but it is explicitly a project waiting to be replaced by the new Flang.

**flang-compiler/flang** — Flang is a Fortran language front-end designed for integration with LLVM.

- Repository: https://github.com/flang-compiler/flang
- Stars: 870 · Forks: 146
- Language: C
- License: NOASSERTION
- Published: 2026-10-20 · Updated: 2026-10-20 · Language: en
- Canonical page: https://hysenlabs.com/projects/flang-compiler-flang

## An out-of-tree Fortran front end, not a new LLVM language

flang-compiler/flang, also known as Classic Flang, is an out-of-tree Fortran compiler targeting LLVM. It is the open-sourced version of pgfortran, a commercial Fortran compiler from PGI/NVIDIA, so the code lineage is a vendor compiler that was opened rather than something written from scratch for a research community. The repository is primarily C, with the usual compiler shape around it: a CMakeLists.txt at the top level, a build-flang.sh driver script, and directories named include/, lib/, runtime/, test/, tools/, utils/, docs/ and scripts/. That layout says the front end, the runtime library and the test suite live in one tree, which is what you would expect from a compiler that is still being carried along by downstream vendors. The audience is narrow and specific: HPC and performance computing toolchains that need a Fortran front end in front of LLVM, plus people studying how such a front end is put together.

## Two compilers named Flang, and one project with a replacement plan

The naming is the first thing to sort out, because a search for Flang returns several unrelated things. The README says plainly that this project is different from the new Flang, formerly known as F18, which has been part of the LLVM project since 2020, and that both are developed by the same community. It also warns that it is unrelated to other projects that happen to share the name. The practical consequence is that documentation, mailing lists and build instructions for the two compilers do not mix. This README points readers at the wiki at github.com/flang-compiler/flang/wiki for project information and at the flang-dev mailing list on lists.llvm.org for announcements and discussion, and it mentions a flang-compiler Slack channel that is invitation only but open to anyone with the link. A second practical consequence: the README states that the plan is to replace Classic Flang with the new Flang. Choosing it is choosing a project with a stated successor.

## Where the build instructions actually live

The README is short on build detail by design. It does not contain a configure line, a CMake invocation or a list of prerequisites. It says that instructions for building Flang can be found on the Flang wiki and links the page Building-Flang under the wiki URL. If you are planning a build, that wiki page is the place to start, and the repository root tells you what the build will touch: build-flang.sh is the script at the top of the tree, CMakeLists.txt drives the configuration, and the runtime/ and test/ directories are where the pieces that get linked and exercised live. A second source of guidance is the compiler itself. Once a build exists, the driver lists its own options, and the README gives that invocation directly:

```bash
% flang -help
```

That command is the fastest way to confirm a build is functional, because a working flang binary that prints its option list is the minimum useful outcome of the wiki procedure. The README does not document how to install a built compiler into a system prefix, and it does not list runtime library search paths, so plan to set those up yourself or to follow the wiki page.

## A Clang driver with a Fortran layer bolted on

The driver design is explicitly Clang based. The README states that Flang accepts all Clang compiler options and supports many of them, then adds a set of Fortran specific flags. The mechanism is therefore layered: the LLVM and Clang option surface is inherited wholesale, and the Fortran dialect options are added on top as a separate group. A portion of that list, taken from the README, looks like this:

```lang-none
-Mfixed               Assume fixed-format source
-Mfreeform            Assume free-format source
-Mextend              Allow source lines up to 132 characters
-Mstandard            Check standard conformance
-module               path to module file (-I also works)
-Mallocatable=03      Select Fortran 03 semantics for assignments to allocatable objects (Default)
-fdefault-integer-8   Treat INTEGER and LOGICAL as INTEGER*8 and LOGICAL*8
-fdefault-real-8      Treat REAL as REAL*8
```

The semantics options are the part that matters for source compatibility work. -Mallocatable=95 and -Mallocatable=03 select different assignment semantics for allocatable objects, with 03 as the default, and the -fdefault-integer-8, -fdefault-real-8, -i8 and -r8 flags change the default kind of the intrinsic types. That combination is how a codebase gets pinned to a specific numeric model when it must reproduce results produced by a vendor compiler.

## OpenMP, library linking and the Fortran main

The remaining flags cover the parts of a build that usually cause friction. Threading is controlled by -mp, which enables OpenMP and links with the OpenMP library libomp, and by -nomp, which links without it. Library linking is decoupled from the front end through -noFlangLibs, which does not link against the Flang libraries, and -static-flang-libs, which links using static Flang libraries. There is also -fno-fortran-main, which stops the driver from linking in the Fortran main, a flag that matters when the Fortran code is called from another language or from a driver you supply yourself. Together these options make it possible to move the same source through different link configurations without changing the compiler build, which is exactly the kind of flexibility a toolchain vendor needs. Note the small inconsistency the list carries, the -M[no]daz, -M[no]flushz and -M[no]fprelaxed forms use bracket notation, and -M[no]fprelaxed is documented as ignored, so do not expect that flag to change anything.

## Where Classic Flang still runs in production

The reason this project is not simply history is that it is embedded in other people's products. The README states that Classic Flang is used in several downstream commercial projects, naming the AMD, Arm and Huawei compilers, and that it continues to be maintained. For a user of those toolchains, that is the deciding fact: a compiler front end that is inside a supported commercial product has a different upgrade path from a standalone project, because the vendor carries the risk of moving their users to the new Flang. For everyone else, the same statement reads the other way, since the plan is to replace Classic Flang with the new Flang in the future. The last push to this repository was on 2026-07-15, and the repository is not archived, so the tree still moves even though the most recent tagged binary releases in the release list are much older, dated 2019 and 2018. Those older releases are artifacts of how the project tags binaries, not evidence that the source has been frozen.

## A custom licence and an inherited codebase

Licensing needs attention here, because GitHub cannot classify the licence for this repository and lists it as Other, with the pointer to the LICENSE file. The repository contains LICENSE.txt at the top level. Because the compiler descends from pgfortran, a commercial PGI/NVIDIA product, the terms are not the plain Apache or MIT text that most open source tooling expects, and you should read LICENSE.txt rather than assume a standard grant. The same inheritance shows up in the code itself: the option set is full of vendor shaped switches such as -Mbackslash, -Mbyteswapio, -Msave and -Mcache_align, none of which follow Clang naming conventions, because they were carried over rather than reinvented. The result is a tree that reads more like an industrial compiler product than a university project, which is useful if you need exactly its behaviour and a burden if you need clean upstream conventions. This is a licensing question for your own counsel, not a conclusion this article can make for you.

## Conclusion

Teams that need the exact front end their commercial HPC toolchain was validated against, or that want to study how a Fortran front end plugs into LLVM, still have a reason to build Classic Flang from build-flang.sh. Everyone starting new Fortran work should use the Flang that has been part of the LLVM project since 2020, because the Classic Flang README states the plan is to replace it. Before building, read LICENSE.txt, since the licence is a custom one that GitHub cannot classify, and confirm against the Flang wiki page Building-Flang that the documented steps still match your LLVM version.

## FAQ

### How do I build Classic Flang?

The README does not contain the build steps itself and points to the Building-Flang page on the Flang wiki at github.com/flang-compiler/flang/wiki. The repository root provides build-flang.sh and a CMakeLists.txt, with the runtime and test directories alongside them.

### What is the difference between Classic Flang and the new Flang?

Classic Flang is the out-of-tree compiler in this repository, an open sourced version of pgfortran. The new Flang, formerly F18, has been part of the LLVM project since 2020, and the README states the plan is to replace Classic Flang with it.

### How do I list the Classic Flang compiler options?

Run flang -help. The option set is inherited from Clang, since Flang accepts all Clang compiler options, plus a group of Fortran specific switches such as -Mfixed, -Mfreeform, -Mstandard and -fdefault-real-8.

### Does Classic Flang support OpenMP?

Yes, through the -mp flag, which enables OpenMP and links with the OpenMP library libomp. Use -nomp to link without it.

### Which commercial compilers are built on Classic Flang?

The README names the AMD, Arm and Huawei compilers as downstream commercial projects that use Classic Flang, and states that the project continues to be maintained. The last push to the repository was on 2026-07-15.

## Sources

- [flang-compiler/flang on GitHub](https://github.com/flang-compiler/flang)
- [Issues](https://github.com/flang-compiler/flang/issues)
- [README](https://github.com/flang-compiler/flang/blob/master/README.md)
- [Releases](https://github.com/flang-compiler/flang/releases)

---

Hysen Labs editorial analysis, written from the project's own repository and release notes. Cite the canonical page: https://hysenlabs.com/projects/flang-compiler-flang
