Silverfrost Forums

Welcome to our forums

Namelist - global or only local?

10 Dec 2020 3:26 #26735

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?

11 Dec 2020 7:11 #26741

Ken

Thanks for this report. I have logged these failures.

21 Dec 2020 1:20 #26810

At the moment FTN95 does not find the host NAMELIST. It must be defined within the module function that uses it. Everything else seems OK.

4 Jan 2021 11:16 #26866

These issues have now been fixed for the next release of FTN95.

Please login to reply.