The following code runs as I expected it to:
program main
implicit none
real :: freq_hz = 50
real :: volts_kv = 0.415
integer :: no_of_poles = 2
namelist /input_data/ freq_hz, volts_kv, no_of_poles
write(6,input_data)
end program main
The following, where the variables and namelist are global fails. FTN95 8.70 Win32 outputs the last element in the namelist, while X64 crashes with an access violation.
module test_mod
implicit none
real :: freq_hz = 50
real :: volts_kv = 0.415
integer :: no_of_poles = 2
namelist /input_data/ freq_hz, volts_kv, no_of_poles
contains
integer function run()
write (6,input_data)
run = 1
end function run
end module test_mod
program main
use test_mod
implicit none
integer i
i = run()
end program main
This second example does appear to be acceptable to one of two alternative compilers.
Should it be possible to use a namelist as a global variable at FTN95 or not? A possible bug?