Gcc/gfortran 16 released

FYI.

Here are the changes listed on the gcc website

  • Coarrays using native shared memory mulithreading on single node machines and handling Fortran 2018’s TEAM feature.
  • Fortran 2003: Parameterized Derived Types support is improved. Handling of LEN parameters works but still requires a future change of representation (see PR82649).
  • Fortran 2018: Support the extensions to the IMPORT statement, the REDUCE intrinsic and the new GENERIC statement.
  • The Fortran 2023 additions to the trigonometric functions are now supported (such as the sinpi intrinsic).
  • Fortran 2023: The split intrinsic subroutine is now supported and c_f_pointer now accepts an optional lower bound as a argument.
  • The -fexternal-blas64 option has been added to call external BLAS routines with 64-bit integer arguments for MATMUL. This option is only valid for 64-bit systems and when -ffrontend-optimize is in effect.

Of these the shared memory version of co-arrays is probably the biggest addition along with improved PDT support

12 Likes

I have tested it with a recent nightly build (see the Fortran Wiki for instructions), using two small demos computing Pi by Monte Carlo with corrays and collectives. GFortran automatically used 8 threads on my machine:

$ /usr/local/bin/gfortran -fcoarray=lib coarrays.f90 -lcaf_shmem
$ ./a.out
   3.1415699479999999 
$ /usr/local/bin/gfortran -fcoarray=lib collective.f90 -lcaf_shmem
$ ./a.out
   3.1415925240000000     
$ /usr/local/bin/gfortran --version
GNU Fortran (GCC) 16.0.1 20260405 (experimental)
Copyright © 2026 Free Software Foundation, Inc.

According to @jerryd , the option -lcaf_shmem is temporarily necessary, until an option like -fcoarray=shared is added in a later release. Note also that I had to put the option -lcaf_shmem at the end of the command for the linker.

Also tested with the GFortran 16.0.1 (20260321) already available in Fedora 44 Beta.

GFortran 16.1 should be released on April, 30th. Today it is the RC.

Also tested with my parallel Buddhabrot demo: gtk-fortran-extra/parallel_app at main · vmagnin/gtk-fortran-extra · GitHub

And note that you can set the number of images with the variable:

$ export GFORTRAN_NUM_IMAGES=8

else GFortran automatically uses the number of available cores.

Thanks. I didn’t see that it was an RC on the web site. I hope the shmem version of CAF performs better than the current MPI based version which (at least on an 8 core Ryzen) doesn’t perform at all and usually “deadlocks”. I have not bothered to dig very deep into the standard CAF implementation (have used Cray’s CAF before) due to the horrendous performance (at least for me) on multi-core “single node” workstations. If the Gfortran shmem version shows a usable speedup then I hope it will lead to further adoption and improvement as more people like me finally start to use CAF.

1 Like

As of last September (2025) they also added F2023 conditional expressions. (A feature Fortran should have had 60+ years ago - if only IBM had listened to John McCarthy.) Particularly with Fortran, it should be useful for simplifying handling optional arguments, where the merge intrinsic doesn’t work.

1 Like