Discussion:
What does F2023:C8107 mean?
(too old to reply)
Steven G. Kargl
2024-08-29 17:59:04 UTC
Permalink
F2023:C8107 states

The namelist-group-name shall not be a name accessed by use association.

Are following pieces of code standard conforming?

! Code 1
module mod_nml1
implicit none
logical :: ldiag
namelist /nam_nml1/ldiag
end module mod_nml1

program ice_nml
use mod_nml1
implicit none
integer :: ilu
ldiag = .false.
write(*,nml=nam_nml1) ! <-- Use assoc. of namelist-group-name
end program ice_nml

! Code 2
module mod_nml1
implicit none
logical :: ldiag
namelist /nam_nml1/ldiag
end module mod_nml1

program ice_nml
use mod_nml1
implicit none
integer :: ilu, j
namelist /nam_nml1/j ! <-- Use assoc of namelist-group-name
ldiag = .false.
j = 42
write(*,nml=nam_nml1) ! <-- Use assoc of namelist-group-name
end program ice_nml

Clarification of the interpretation of C8107 would be appreciated?
--
steve
Steven G. Kargl
2024-08-29 20:50:03 UTC
Permalink
Post by Steven G. Kargl
F2023:C8107 states
The namelist-group-name shall not be a name accessed by use association.
Are following pieces of code standard conforming?
! Code 1
module mod_nml1
implicit none
logical :: ldiag
namelist /nam_nml1/ldiag
end module mod_nml1
program ice_nml
use mod_nml1
implicit none
integer :: ilu
ldiag = .false.
write(*,nml=nam_nml1) ! <-- Use assoc. of namelist-group-name
end program ice_nml
! Code 2
module mod_nml1
implicit none
logical :: ldiag
namelist /nam_nml1/ldiag
end module mod_nml1
program ice_nml
use mod_nml1
implicit none
integer :: ilu, j
namelist /nam_nml1/j ! <-- Use assoc of namelist-group-name
ldiag = .false.
j = 42
write(*,nml=nam_nml1) ! <-- Use assoc of namelist-group-name
end program ice_nml
Clarification of the interpretation of C8107 would be appreciated?
After a few minutes re-reading parts of Fortran 2023, I have concluded
that Code 1 is conforming and Code 2 is non-conforming. My issue was
caused by gfortran accepting Code 2 without and error or warning under
-std=gnu option (default behavior). If -std=f2023 is used, then gfortran
issues an expected error messages.
--
steve
Loading...