Paul,
One for you to look at as I think the following code demonstrates a bug with FTN95.
Perhaps I should temper my present enthusiasum for eliminating do loops!
program p
implicit none
integer, parameter :: n = 1000
real*8 :: x(n), random_y(n), mean_y(n)
integer :: i
! Generate random data, a sample count in x, and running mean_y
call random_number(random_y)
x = [(i, i = 1, n)]
!do i = 1, n
! mean_y(i) = sum(random_y(1:i))/x(i)
!end do
! When the do loop above is replaced by the following 'equivalent code' which
! makes use of an array constructor FTN 9.06 returns the running mean values
! as all zero.
! FTN 9.03 also fails with this code.
! Checkmate reports Error 112 Reference to undefined variable.
! All variables on the RHS have previously been assigned values.
mean_y = [(sum(random_y(1:i)) / x(i), i = 1, n)]
do i = 1, n
print*, i, mean_y(i)
end do
end program p