Fortran

This page lists the status of FORTRAN compilers for windows on arm targets.

Classic Flang

Classic Flang is an out-of-tree Fortran compiler targeting LLVM. It is an open-sourced version of pgfortran, a commercial Fortran compiler from PGI/NVIDIA.

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

It is different from the new Flang (formerly known as "F18"; see Welcome to Flang’s documentation — The Flang Compiler ), which has been part of the LLVM project since 2020, although both are developed by the same community. It is also unrelated to other projects of the same name, such as GitHub - llvm-flang/flang: Fortran Front-End  and GitHub - isanbard/flang: Fortran Front-End .

Classic Flang is used in several downstream commercial projects and continues to be maintained, but the plan is to replace Classic Flang with the new Flang in the future.

WoA Status

WoA support for classic flang is still a work in progress. ARM is working on adding support for WoA and patches are not yet upstreamed and there are no official windows on arm releases yet. A release preview can be found Release flang_woa_20210514_pre · kaadam/flang

We have evaluated classic flang to build OpenBLAS and Scipy python packages and it works out of the box for most scenarios but there are very few bugs found during the evaluation specific for windows on arm targets.

  • Classic flang compiler limitation around NaN comparison operators.

  • Classic flang seems to optimize certain FORTRAN routines wrongly. 

Future Plans

ARM is still working on enabling windows on arm support for classic clang. The work is still in the early stages and the focus is now on classic flang compilation for woa and upstreaming changes to enable build etc. Once the initial build issues are resolved it might be possible to pursue community to look at specific bugs we found. Also, remember classic flang will be replaced by new flang in the near future so putting too much effort into it might not make much sense.

New Flang

New flang or previously known as f18 is a fortran frontend developed by llvm community.

GitHub - flang-compiler/f18-llvm-project: Fork of llvm/llvm-project for f18. In sync with f18-mlir and f18.

As of LLVM 12.0, New flang by default uses an external fortran compiler to do the code generation after parsing and type checking and re-generating fortran code and uses external compiler for code generation.

New flang doesn’t yet officially support Windows platforms as per LLVM 12.0 release notes Flang 12.0.0 (In-Progress) Release Notes — The Flang Compiler

One of the main limitations of the new flang seems to be that there is no driver support for end-to-end code generation. The compilation can be done with the help of few development tools as described in the example here f18-llvm-project/flang/test/Lower/end-to-end-always-exec-loopbody.f90 at fir-dev · flang-compiler/f18-llvm-project

WoA Status

See Flang support in LLVM (FLANG)

gFortran

gFortran doesn’t yet have arm targets for windows builds.

Future Plans

Linaro’s effort to port GNU Toolchain for Windows/Arm64 would enable gFortran.

Â