View previous topic :: View next topic |
Author |
Message |
jlb
Joined: 21 Oct 2020 Posts: 75
|
Posted: Thu Oct 17, 2024 9:58 pm Post subject: Nested modules |
|
|
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
Quote: | warning 1259 - COMPILER_VERSION is a standard intrinsic that requires USE ISO_FORTRAN_ENV. |
I must be overlooking something trivial.
Code: | 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 |
Last edited by jlb on Fri Oct 18, 2024 6:35 pm; edited 1 time in total |
|
Back to top |
|
|
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 8061 Location: Salford, UK
|
Posted: Fri Oct 18, 2024 7:25 am Post subject: |
|
|
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(). |
|
Back to top |
|
|
jlb
Joined: 21 Oct 2020 Posts: 75
|
Posted: Fri Oct 18, 2024 6:34 pm Post subject: |
|
|
Paul
Thank you for your usual prompt and and enlightening reply. |
|
Back to top |
|
|
|