mecej4
Joined: 31 Oct 2006 Posts: 1895
|
Posted: Tue Apr 10, 2018 4:46 pm Post subject: Optimiser bug, 32-bit FTN95 8.10, namelist input |
|
|
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.
Code: | 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:
Code: | &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: http://forums.silverfrost.com/viewtopic.php?t=3752&highlight=amdfillnamelistblock
When compiled with /opt in 32-bit mode, the code aborts with the following report:
Code: | 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. |
|