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.

https://github.com/flang-compiler/flang

It is different from the new Flang (formerly known as "F18"; see https://flang.llvm.org/ ), 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 https://github.com/llvm-flang/flang  and https://github.com/isanbard/flang .

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 https://github.com/kaadam/flang/releases/tag/v0.1

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.

https://github.com/flang-compiler/f18-llvm-project

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 https://releases.llvm.org/12.0.1/tools/flang/docs/ReleaseNotes.html

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 https://github.com/flang-compiler/f18-llvm-project/blob/fir-dev/flang/test/Lower/end-to-end-always-exec-loopbody.f90

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.

Â