Skip to content

Fujitsu compiler: tests require compiler version ≥ 4.11.2

In old versions of the Fujitsu compiler (afaict up to version 4.11.1 20231220) there is a compiler bug that prevents compilation of the tests. This means that building the package with spack fails.

The bug involves the compiler not detecting that a procedure pointer that is declared in a module with default private accessibility should not be accessible when the module is USE'd elsewhere.

Compilation errors look like this:

Fortran diagnostic messages: program name(test_units)
  jwd1736i-s  "/home/jme52/libfdf/tests/test-units.f90", line 15, column 29: 'inquire_unit' cannot be referenced; it is specified in more than one module or refers to more than one entity.

The compiler bug seems fixed in more recent versions of the compiler, such as version 4.11.2 20240524 (Fugaku module lang/tcsds-1.2.40) and version 4.12.0 20241114 (Fugaku module lang/tcsds-1.2.41).

Given that this is a fixed compiler bug, the solution to this issue is to update the compiler to a more recent version of the Fujitsu compiler. Note that at the moment Deucalion does not have any such Fujitsu compiler, so we should probably request that a more recent version is installed. Alternatively, the GCC compiler could be used.


For reference, a MWE for quickly detecting this issue in a compiler is as follows:

MODULE foo
  implicit none

  interface
    subroutine si ; end
  end interface

  private
  procedure(si), pointer :: s => null()

END MODULE
!-----------------
MODULE bar
  implicit none
CONTAINS
  subroutine s ; end
END MODULE
!-----------------
PROGRAM p
  use foo
  use bar
  implicit none

  call s
END