GCC 14 Fortran features

GCC 14.1 was released on May 7. Below are the new Fortran-related features of GCC 14. Equation.com has Windows binaries for gcc/gfortran 15 (beta). Thanks to the gfortran developers for their efforts.

General Improvements

  • For offload-device code generated via OpenMP and OpenACC, the math and the Fortran runtime libraries will now automatically be linked, when the user or compiler links them on the host side. Thus, it is no longer required to explicitly pass -lm and/or -lgfortran to the offload-device linker using the -foffload-options= flag.

New Languages and Language specific improvements

OpenMP

  • OpenMP 5.0: The allocate directive is now supported for stack variables in C and Fortran, including the OpenMP 5.1 align modifier. In C and C++ the map clause now accepts lvalue expressions. For Fortran, OpenMP allocators can now be used for allocatables and pointers using the allocate directive and its OpenMP 5.2 replacement, the allocators directive; files using this allocator and all files that might directly or indirectly (intrinisic assignment, intent(out), …) de- or reallocate such-allocated variables must be compiled with the -fopenmp-allocators option.
  • OpenMP 5.2: The OMP_TARGET_OFFLOAD=mandatory handling has been updated for the clarifications and changes of the 5.2 specification. For Fortran, the list of directives permitted in Fortran pure procedures was extended. Additionally, the spec change has been implemented for default implicit mapping of C/C++ pointers pointing to unmapped storage. The destroy clause now optionally accepts the depend object as argument.

OpenACC

  • OpenACC 3.2: The following API routines are now available in Fortran using the openacc module or the openacc_lib.h header file: acc_malloc, acc_free, acc_map_data, acc_unmap_data, acc_deviceptr, acc_hostptr, acc_memcpy_to_device, acc_memcpy_to_device_async, acc_memcpy_from_device, and acc_memcpy_from_device_async.

Fortran

  • The compiler now accepts the -std=f2023 option, which has been added in preparation of support of Fortran 2023. This option increases the line-length limit for source in free-form to 10000, and statements may have up to 1 million characters.
  • With the -save-temps option, preprocessed files with the .fii extension will be generated from free-form source files such as .F90 and .fi from fixed-form files such as .F.
18 Likes