The following test program is intended for the sole purpose of demonstrating a bug in the current compiler when /check is used. The full program where the bug was encountered had dozens of subprograms and was about 7,200 lines long.
! compile with /check
program gamdrv
! implicit none ! activating this declaration makes bug go away
integer, parameter :: MD = 8
integer neqn, ipar(MD+1)
real h, y(MD)
integer iout ! unused, but its presence causes bug
external solout
neqn=8
y(1:8) = (/1.0,0.,0.,0.,0.,0.,0.,0.006/)
h = 0.01
ipar(1:9)=(/8,1,2,3,4,5,6,7,8/)
call gamd(neqn,y,h,solout,ipar)
end program gamdrv
!
subroutine gamd(r,y0,h,solout,ipar)
implicit none
integer, intent(in) :: r, ipar(*)
real, intent(in out) :: y0(r), h
integer :: irtrn
external :: solout
call solout(ipar, irtrn)
return
end subroutine gamd
subroutine solout(ipar,irtrn)
implicit none
integer ipar(*),irtrn,nindsol
integer i
nindsol = ipar(1)
print '(1x,20i4)',(ipar(i),i=2,nindsol+1)
irtrn = 0
stop
return
end subroutine solout
Note that there are some variables present that are not really needed, but their presence is necessary for the bug to occur.
The bug is exhibited (subscript out of bounds on the PRINT statement) with compiler versions 8.82 and 8.61, with or without /64, provided /check is used. The old 7.20 version does not have this bug.
Array subscript(s) out-of-bounds at address 401f3c
Within file salbug.EXE
in SOLOUT in line 31, at address 21a
in GAMD in line 22, at address 2f2
in GAMDRV in line 13, at address 128
Thanks.