Silverfrost Forums

Welcome to our forums

Nested modules

17 Oct 2024 8:58 (Edited: 18 Oct 2024 5:35) #31622

I cannot understand why the intrinsic function COMPILER_VERSION cannot be accessed from the main program through the nested modules MOD1 and MOD2, but the function DBL can. The compiler warns with

warning 1259 - COMPILER_VERSION is a standard intrinsic that requires USE ISO_FORTRAN_ENV.

I must be overlooking something trivial.

MODULE MOD1
USE ISO_FORTRAN_ENV
IMPLICIT NONE
INTEGER, PARAMETER :: M1=1
CONTAINS
INTEGER FUNCTION DBL(X)
  IMPLICIT NONE
  INTEGER, INTENT(IN) :: X
  DBL=2*X
END FUNCTION DBL
END MODULE MOD1

MODULE MOD2
USE MOD1
IMPLICIT NONE
INTEGER, PARAMETER :: M2=2
END MODULE MOD2

PROGRAM MODTEST
USE MOD2
IMPLICIT NONE
WRITE(*,*) 'Version : ', COMPILER_VERSION()
WRITE(*,*) M1, M2, DBL(3)
END PROGRAM MODTEST
18 Oct 2024 6:25 #31623

jlb

Your code exposes a bug in FTN95. For the time being it is necessary to move USE ISO_FORTRAN_ENV to the main program or, in general, to the subprogram that calls COMPILER_VERSION().

18 Oct 2024 5:34 #31628

Paul Thank you for your usual prompt and and enlightening reply.

18 Dec 2024 7:41 #31746

This failure has now been fixed for the next release of FTN95.

18 Dec 2024 5:11 #31747

Paul Thank you very much for this improvement.

Please login to reply.