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.

15 Likes

Well done!
Make Fortran Great Again!

2 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:

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))
1 Like