Silverfrost Forums

Welcome to our forums

Optimiser bug, 32-bit FTN95 8.10, namelist input

10 Apr 2018 3:46 #21789

The following program is a compacted bug demonstrator; it does nothing useful, but should run, read data from a file and print a single line of output.

program swmol3
   implicit none
   integer, parameter :: nht = 7
   integer , dimension(nht) :: iad
   integer :: inutmp, natype, nsymop, id3, nont, i
   character , dimension(3) :: symop*3
   character :: title1*72, title2*72
   namelist /molb/inutmp, title1, title2, natype, nsymop, symop, id3
   data id3,nont,inutmp/ 0,1,0/
   data title2/ '        '/
   data symop/ 3*'   '/
   open(15, file='int.inp', status='old', form='formatted')
   rewind(15)
   read (15, nml=molb)
   write (6, *) 'MOLB namelist read'
   close(15)
   stop
               ! *** NOTE: the code below will never be executed,
               ! *** but the bug depends on some part of it!
   do i = 1, natype
      iad(i) = 0
   end do
   write (*, *) natype, nsymop, iad
   stop
end

The data file, 'int.inp', contains:

 &molb
  title1='O2 TZ (Dunning) EMSL',
  natype=1, nsymop=3, symop='X','Y','Z'
 /end

The bug occurs when /opt is used. The 64-bit compiler will not even compile the code with /opt, as reported earlier: https://forums.silverfrost.com/Forum/Topic/3339&highlight=amdfillnamelistblock

When compiled with /opt in 32-bit mode, the code aborts with the following report:

Runtime error from program:s:\ftn95\reads.exe
Access Violation
The instruction at address 10138c5c attempted to write to location 00403f98

 10138bdb read_INTEGER_4(<ref>int) [+0081]
 10139eaa read_namelist_value(char,<ptr>void,int,int,int) [+00a1]
 1013beab RNML__ [+042d]
 1011f72a doIO(void) [+0450]
 10127ba0 IOSTART__ [+0275]
 00401000 SWMOL3 [+016a]

Curiously, the bug surfaces only if some lines of code that have no path to them are left in the source file, as noted in the comments in the source.

12 Apr 2018 6:29 #21800

Thank you. I have made a note of this.

12 Apr 2018 7:15 #21816

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

Please login to reply.