Compare and contrast the two following snippets of code ...
FTN95 v6 issues several errors (as it should) if asked to compile this:
program parammed
use param
integer i, six (six)
six (:) = 6
write (*, '(i10)') (six (i), i = 1, 6)
end program parammed
module param
integer, parameter :: six = 6
end module param
On the other hand, it is happy to compile and run the following without error, even using /CHECKMATE:
program parammed
use param
call sixy
end program parammed
module param
integer, parameter :: six = 6
contains
subroutine sixy
integer i, six (six)
six (:) = 6
write (*, '(i10)') (six (i), i = 1, 6)
end subroutine sixy
end module param
It manages to use the PARAMETER declaration of six to redefine six as an integer array with six elements. I know that there are no reserved names in FORTRAN, but I think a compiler ought to recognise when a program attempts to redefine its own terminology (as it does in the first example). Ask not how I came by this perverse concept 😃 but seems a pretty clear bug to me. What do others think?