FTN95 8.30.279 produces incorrect results or aborts with floating point errors for the following correct code. The value on line-21 was chosen to make the result to be exactly 0.
program tfu
implicit none
integer, parameter :: double=kind(0.d0), NX=16
real(double) :: x(NX),F
integer :: i,n
!
n = NX
Do i = 1, n, 4
x(i) = 1.0D0
x(i+1) = 3.0D0
x(i+2) =-1.0D0
x(i+3) = 0.0D0
End Do
print 10,x
F = sum (( x(:n-3:2) + 1.0D1*x(2:n-2:2))**2 &
+ 5.0D0*(x(3:n-1:2) - x(4:n:2))**2 &
+ (x(2:n-2:2) - 2.0D0*x(3:n-1:2))**4 &
+ 1.0D1*(x(:n-3:2) - x(4:n:2))**4) &
- 14195d0
print 20,F
10 format ('X = [',16F5.1,']')
20 format('F = ',F10.1,', expected value = 0.0')
End Program
The results from various runs:
OPTION RESULT
/check -11040.0
/checkmate -11040.0
- default - Floating point divide by zero
/opt Floating point divide by zero
/64 /check -11040.0
/64 *** AMD backend failure
/64 /opt -16929.0