GNU Fortran 15.1 has been released

Greetings,

the GCC developers announced the release of GCC 15.1. The change log mentions the following updates to GNU Fortran:

  • Fortran 2018 and 2023 locality specifiers to do concurrent are now supported.
  • Experimental support for unsigned modular integers, enabled by -funsigned; see gfortran documentation for details. This follows (J3/24-116). With this option in force, the selected_logical_kind intrinsic function and, in the ISO_FORTRAN_ENV module, the named constants logical{8,16,32,64} and real16 were added. The ISO_C_BINDING module has been extended accordingly.
  • Missing commas separating descriptors in input/output format strings are no longer permitted by default and are rejected at run-time unless -std=legacy is used when compiling the main program unit. See Fortran 2023 constraint C1302.
  • The Fortran module *.mod format generated by GCC 15 is incompatible with the module format generated by GCC 8 - 14, but GCC 15 can for compatibility still read GCC 8 - 14 created module files.
  • Coarray support has been reworked to allow access to components in derived types that have not been compiled with coarray support enabled; especially, when the derived type is in a binary only module. This has changed the ABI and may lead to link-time errors with object files generated with a previous GCC version and to be linked to the current caf_single library. If this library is to be used, then it is recommended to recompile all artifacts. The OpenCoarrays library is not affected, because it provides backwards compatibility with the older ABI.
  • The -Wexternal-interface-mismatch option has been added. This checks for mismatches between the argument lists in dummy external arguments, and is implied by -Wall and -fc-prototypes-external options.
  • The -fc-prototypes now also generates prototypes for interoperable procedures with assumed shape and assumed rank arguments that require the header file <ISO_Fortran_binding.h>.

GNU Fortran has now experimental support for unsigned types, with additional type constants available:

The following constants have been added to the intrinsic ISO_C_BINDING module: c_unsigned, c_unsigned_short, c_unsigned_char, c_unsigned_long, c_unsigned_long_long, c_uintmax_t, c_uint8_t, c_uint16_t, c_uint32_t, c_uint64_t, c_uint128_t, c_uint_fast8_t, c_uint_fast16_t, c_uint_fast32_t, c_uint_fast64_t, c_uint_fast128_t, c_uint_least8_t, c_uint_least16_t, c_uint_least32_t, c_uint_least64_t and c_uint_least128_t.

The following constants have been added to the intrinsic ISO_FORTRAN_ENV module: uint8, uint16, uint32 and uint64.

27 Likes

Well done!
Make Fortran Great Again!

5 Likes

GCC 15.1 is available in Fedora Rawhide (unstable). I guess it will soon arrive in the recent Fedora 42, but today it is yet 15.0.1:

1 Like

This is great news. Do you have any plans leveraging that for the fortran-sdl2 interface? (It has been a while, but I seem to recall running into some issues using RGB values higher than 127, which may have been related to SDL using unsigned integers).

I think the issue is that unsigned integers are not part of any Fortran standard yet.
The good news is that flang implements unsigned integers following the “conventions” by gfortran.
(The Gfortran solution was inspired by a proprietary extension by Sun Microsystems).

2 Likes

Not in the foreseeable future, but there is a utility function uint8() you can use to set unsigned colour values, for instance:

type(sdl_color) :: color
color = sdl_color(r = uint8(255), &
                  g = uint8(127), &
                  b = uint8(0),   &
                  a = uint8(SDL_ALPHA_OPAQUE))
3 Likes

Thanks, Philip. I really appreciate the amount of work you must have put into fortran-sdl2, btw. I already used it a few times for visualisation.

1 Like

I’m really happy to see the locality specifier support for do concurrent now in gfortran!

1 Like

Note that the GFortran and Flang’s prototype implementation of unsigned wraps around, so for the SDL2 application I almost certainly do not want things to wrap around as a user, I would like to get a runtime (or compile time if possible) error if I make a mistake how I use unsigned.

to check the locality specification support, i downloaded it from Equation.

  • The first thing it shows is version 16 and not 15.1.
D:\testing_gfortran15Version>gfortran --version
GNU Fortran (GCC) 16.0.0 20250420 (experimental)
Copyright (C) 2025 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
D:\testing_gfortran15Version>gfortran -march=native -D_USE_DO_CONCURRENT_  omp.F90

D:\testing_gfortran15Version>a
 start of program           4           8
 Vern : GCC version 16.0.0 20250420 (experimental)
 Opts : -cpp -iprefix C:/Users/owner/gcc/bin/../lib/gcc/x86_64-w64-mingw32/16.0.0/ -U_REENTRANT -D _USE_DO_CONCURRENT_ -march=rocketlake -mmmx -mpopcnt -msse -msse2 -msse3 -mssse3 -msse4.1 -msse4.2 -mavx -mavx2 -mno-sse4a -mno-fma4 -mno-xop -mfma -mavx512f -mbmi -mbmi2 -maes -mpclmul -mavx512vl -mavx512bw -mavx512dq -mavx512cd -mavx512vbmi -mavx512ifma -mavx512vpopcntdq -mavx512vbmi2 -mgfni -mvpclmulqdq -mavx512vnni -mavx512bitalg -mno-avx512bf16 -mno-avx512vp2intersect -mno-3dnow -madx -mabm -mno-cldemote -mclflushopt -mno-clwb -mno-clzero -mcx16 -mno-enqcmd -mf16c -mfsgsbase -mfxsr -mno-hle -msahf -mno-lwp -mlzcnt -mmovbe -mno-movdir64b -mno-movdiri -mno-mwaitx -mno-pconfig -mno-pku -mprfchw -mno-ptwrite -mrdpid -mrdrnd -mrdseed -mno-rtm -mno-serialize -mno-sgx -msha -mno-shstk -mno-tbm -mno-tsxldtrk -mvaes -mno-waitpkg -mno-wbnoinvd -mxsave -mxsavec -mxsaveopt -mxsaves -mno-amx-tile -mno-amx-int8 -mno-amx-bf16 -mno-uintr -mno-hreset -mno-kl -mno-widekl -mno-avxvnni -mno-avx512fp16 -mno-avxifma -mno-avxvnniint8 -mno-avxneconvert -mno-cmpccxadd -mno-amx-fp16 -mno-prefetchi -mno-raoint -mno-amx-complex -mno-avxvnniint16 -mno-sm3 -mno-sha512 -mno-sm4 -mno-apxf -mno-usermsr -mno-avx10.2 -mno-amx-avx512 -mno-amx-tf32 -mno-amx-transpose -mno-amx-fp8 -mno-movrs -mno-amx-movrs --param=l1-cache-size=48 --param=l1-cache-line-size=64 --param=l2-cache-size=12288 -mtune=rocketlake
     0.000  start
       0.1  initialise phi
 Done steps =          100
 Done steps =          200
 Done steps =          300
 Done steps =          400
 Done steps =          500
 Done steps =          600
 Done steps =          700
 Done steps =          800
 Done steps =          900
 Done steps =         1000
 Done steps =         1100
 Done steps =         1200
 Done steps =         1300
 Done steps =         1400
 Done steps =         1500
 Done steps =         1600
 Done steps =         1700
 Done steps =         1800
 Done steps =         1900
 Done steps =         2000
     725.2  time_loop
 nx=        2000 ny=        2000
stages:         0.0       353.6       371.7
  • OpenMP test runs in parallel, apparently.
D:\testing_gfortran15Version>gfortran -march=native -fopenmp omp.F90

D:\testing_gfortran15Version>a
 start of program           4           8
 Vern : GCC version 16.0.0 20250420 (experimental)
 Opts : -cpp -iprefix C:/Users/owner/gcc/bin/../lib/gcc/x86_64-w64-mingw32/16.0.0/ -D_MT -D_REENTRANT -U_REENTRANT -march=rocketlake -mmmx -mpopcnt -msse -msse2 -msse3 -mssse3 -msse4.1 -msse4.2 -mavx -mavx2 -mno-sse4a -mno-fma4 -mno-xop -mfma -mavx512f -mbmi -mbmi2 -maes -mpclmul -mavx512vl -mavx512bw -mavx512dq -mavx512cd -mavx512vbmi -mavx512ifma -mavx512vpopcntdq -mavx512vbmi2 -mgfni -mvpclmulqdq -mavx512vnni -mavx512bitalg -mno-avx512bf16 -mno-avx512vp2intersect -mno-3dnow -madx -mabm -mno-cldemote -mclflushopt -mno-clwb -mno-clzero -mcx16 -mno-enqcmd -mf16c -mfsgsbase -mfxsr -mno-hle -msahf -mno-lwp -mlzcnt -mmovbe -mno-movdir64b -mno-movdiri -mno-mwaitx -mno-pconfig -mno-pku -mprfchw -mno-ptwrite -mrdpid -mrdrnd -mrdseed -mno-rtm -mno-serialize -mno-sgx -msha -mno-shstk -mno-tbm -mno-tsxldtrk -mvaes -mno-waitpkg -mno-wbnoinvd -mxsave -mxsavec -mxsaveopt -mxsaves -mno-amx-tile -mno-amx-int8 -mno-amx-bf16 -mno-uintr -mno-hreset -mno-kl -mno-widekl -mno-avxvnni -mno-avx512fp16 -mno-avxifma -mno-avxvnniint8 -mno-avxneconvert -mno-cmpccxadd -mno-amx-fp16 -mno-prefetchi -mno-raoint -mno-amx-complex -mno-avxvnniint16 -mno-sm3 -mno-sha512 -mno-sm4 -mno-apxf -mno-usermsr -mno-avx10.2 -mno-amx-avx512 -mno-amx-tf32 -mno-amx-transpose -mno-amx-fp8 -mno-movrs -mno-amx-movrs --param=l1-cache-size=48 --param=l1-cache-line-size=64 --param=l2-cache-size=12288 -mtune=rocketlake -mthreads -fopenmp
 Number of OMP threads =           12
     0.000  start
       0.1  initialise phi
 Done steps =          100
 Done steps =          200
 Done steps =          300
 Done steps =          400
 Done steps =          500
 Done steps =          600
 Done steps =          700
 Done steps =          800
 Done steps =          900
 Done steps =         1000
 Done steps =         1100
 Done steps =         1200
 Done steps =         1300
 Done steps =         1400
 Done steps =         1500
 Done steps =         1600
 Done steps =         1700
 Done steps =         1800
 Done steps =         1900
 Done steps =         2000
     122.0  time_loop
 nx=        2000 ny=        2000
stages:         0.0        69.7        52.2

Have you got the required flags? My understanding (based mostly on DO CONCURRENT: compiler flags to enable parallelization - #6 by ivanpribec which I see you also are active in), was that it needed the -ftree-parallelize-loops=n flag. Perhaps just openMP would also work?

1 Like

Any idea about when conditional expressions will be supported?

I do not find any performance gain

C:\Users\USER\Desktop>gfortran -march=native -D_USE_DO_CONCURRENT_ -ftree-parallelize-loops=4 omp.F90

C:\Users\USER\Desktop>a
 start of program           4           8
 Vern : GCC version 16.0.0 20250420 (experimental)
 Opts : -cpp -iprefix C:/Users/USER/gcc/bin/../lib/gcc/x86_64-w64-mingw32/16.0.0/ -D_MT -D_REENTRANT -U_REENTRANT -D _USE_DO_CONCURRENT_ -march=skylake -mmmx -mpopcnt -msse -msse2 -msse3 -mssse3 -msse4.1 -msse4.2 -mavx -mavx2 -mno-sse4a -mno-fma4 -mno-xop -mfma -mno-avx512f -mbmi -mbmi2 -maes -mpclmul -mno-avx512vl -mno-avx512bw -mno-avx512dq -mno-avx512cd -mno-avx512vbmi -mno-avx512ifma -mno-avx512vpopcntdq -mno-avx512vbmi2 -mno-gfni -mno-vpclmulqdq -mno-avx512vnni -mno-avx512bitalg -mno-avx512bf16 -mno-avx512vp2intersect -mno-3dnow -madx -mabm -mno-cldemote -mclflushopt -mno-clwb -mno-clzero -mcx16 -mno-enqcmd -mf16c -mfsgsbase -mfxsr -mno-hle -msahf -mno-lwp -mlzcnt -mmovbe -mno-movdir64b -mno-movdiri -mno-mwaitx -mno-pconfig -mno-pku -mprfchw -mno-ptwrite -mno-rdpid -mrdrnd -mrdseed -mno-rtm -mno-serialize -msgx -mno-sha -mno-shstk -mno-tbm -mno-tsxldtrk -mno-vaes -mno-waitpkg -mno-wbnoinvd -mxsave -mxsavec -mxsaveopt -mxsaves -mno-amx-tile -mno-amx-int8 -mno-amx-bf16 -mno-uintr -mno-hreset -mno-kl -mno-widekl -mno-avxvnni -mno-avx512fp16 -mno-avxifma -mno-avxvnniint8 -mno-avxneconvert -mno-cmpccxadd -mno-amx-fp16 -mno-prefetchi -mno-raoint -mno-amx-complex -mno-avxvnniint16 -mno-sm3 -mno-sha512 -mno-sm4 -mno-apxf -mno-usermsr -mno-avx10.2 -mno-amx-avx512 -mno-amx-tf32 -mno-amx-transpose -mno-amx-fp8 -mno-movrs -mno-amx-movrs --param=l1-cache-size=32 --param=l1-cache-line-size=64 --param=l2-cache-size=3072 -mtune=skylake -mthreads -ftree-parallelize-loops=4
     0.000  start
       0.0  initialise phi
 Done steps =          100
 Done steps =          200
 Done steps =          300
 Done steps =          400
 Done steps =          500
 Done steps =          600
 Done steps =          700
 Done steps =          800
 Done steps =          900
 Done steps =         1000
 Done steps =         1100
 Done steps =         1200
 Done steps =         1300
 Done steps =         1400
 Done steps =         1500
 Done steps =         1600
 Done steps =         1700
 Done steps =         1800
 Done steps =         1900
 Done steps =         2000
      13.2  time_loop
 nx=         200 ny=         200
stages:         0.0         8.7         4.5
C:\Users\USER\Desktop>gfortran -march=native omp.F90

C:\Users\USER\Desktop>a
 start of program           4           8
 Vern : GCC version 16.0.0 20250420 (experimental)
 Opts : -cpp -iprefix C:/Users/USER/gcc/bin/../lib/gcc/x86_64-w64-mingw32/16.0.0/ -U_REENTRANT -march=skylake -mmmx -mpopcnt -msse -msse2 -msse3 -mssse3 -msse4.1 -msse4.2 -mavx -mavx2 -mno-sse4a -mno-fma4 -mno-xop -mfma -mno-avx512f -mbmi -mbmi2 -maes -mpclmul -mno-avx512vl -mno-avx512bw -mno-avx512dq -mno-avx512cd -mno-avx512vbmi -mno-avx512ifma -mno-avx512vpopcntdq -mno-avx512vbmi2 -mno-gfni -mno-vpclmulqdq -mno-avx512vnni -mno-avx512bitalg -mno-avx512bf16 -mno-avx512vp2intersect -mno-3dnow -madx -mabm -mno-cldemote -mclflushopt -mno-clwb -mno-clzero -mcx16 -mno-enqcmd -mf16c -mfsgsbase -mfxsr -mno-hle -msahf -mno-lwp -mlzcnt -mmovbe -mno-movdir64b -mno-movdiri -mno-mwaitx -mno-pconfig -mno-pku -mprfchw -mno-ptwrite -mno-rdpid -mrdrnd -mrdseed -mno-rtm -mno-serialize -msgx -mno-sha -mno-shstk -mno-tbm -mno-tsxldtrk -mno-vaes -mno-waitpkg -mno-wbnoinvd -mxsave -mxsavec -mxsaveopt -mxsaves -mno-amx-tile -mno-amx-int8 -mno-amx-bf16 -mno-uintr -mno-hreset -mno-kl -mno-widekl -mno-avxvnni -mno-avx512fp16 -mno-avxifma -mno-avxvnniint8 -mno-avxneconvert -mno-cmpccxadd -mno-amx-fp16 -mno-prefetchi -mno-raoint -mno-amx-complex -mno-avxvnniint16 -mno-sm3 -mno-sha512 -mno-sm4 -mno-apxf -mno-usermsr -mno-avx10.2 -mno-amx-avx512 -mno-amx-tf32 -mno-amx-transpose -mno-amx-fp8 -mno-movrs -mno-amx-movrs --param=l1-cache-size=32 --param=l1-cache-line-size=64 --param=l2-cache-size=3072 -mtune=skylake
     0.000  start
       0.0  initialise phi
 Done steps =          100
 Done steps =          200
 Done steps =          300
 Done steps =          400
 Done steps =          500
 Done steps =          600
 Done steps =          700
 Done steps =          800
 Done steps =          900
 Done steps =         1000
 Done steps =         1100
 Done steps =         1200
 Done steps =         1300
 Done steps =         1400
 Done steps =         1500
 Done steps =         1600
 Done steps =         1700
 Done steps =         1800
 Done steps =         1900
 Done steps =         2000
      12.9  time_loop
 nx=         200 ny=         200
stages:         0.0         8.7         4.2

I have just discovered that GFortran received funds (360000 €) in 2024 and 2025 from the German Sovereign Tech Fund:

The work the Sovereign Tech Fund is commissioning on GFortran improves parallel computing support, fixes critical standards compliance issues, and overhauls key internal systems for better performance and maintainability. It ensures GFortran remains a reliable, high-performance tool for scientific and engineering communities.

  • Provide coarray support using a shared memory model to enable efficient parallel computing on modern hardware.
  • Enhance distributed memory features to allow better handling of complex data structures in coarray programs.
  • Expand and stabilize teams and failed image support to make programs more resilient and scalable.
  • Fix compliance issues related to finalization and the associate construct to meet modern Fortran standards.
  • Modernize array handling by updating the array descriptor for better performance and C interoperability.
  • Simplify and improve scalarization to make the compiler more maintainable and efficient.
9 Likes