In the following test, FTN95 seems to lose track of the fact that variable I is used as a ac-do-variable in the array constructor:
program init_bug implicit none
integer :: i character(11), parameter :: string='hello world'
! This compiles: character, parameter :: up_string(len (string)) = & (/ (string(i:i), i=1, len (string)) /)
! Yet this does not compile: integer, parameter :: bytes(len (string)) = & (/ (iachar (string(i:i)), i=1, len (string)) /)
print *, string print *, up_string print *, bytes
end program
FTN95 reports the following:
[FTN95/Win32 Ver. 5.10.0 Copyright (c) Silverfrost Ltd 1993-2007] 0012) integer, parameter :: bytes(len (string)) = & 0013) (/ (iachar (string(i:i)), i=1, len (string)) /) *** I is not a PARAMETER, so cannot appear in an initialisation expression
1 ERROR [salford_init_bug1.F90] - Compilation failed.
Playing around with the example a bit, I tried making I a PARAMETER. (This should not be needed, and may be illegal.) Depending on case FTN95 either generated bad code or simply crashed!