I’m sure the answer to this is something simple to do with the Fortran standard, but for the life of me I can’t figure out what.
Namely, I’m trying to make up a module that contains a whole bunch of definitions of arrays and initialize their values. So, I tried and got a failure. A simple program that demonstrates the way I thought of doing this is:
module tinyconstants
implicit none
real, dimension(5) :: hk_uv_const
hk_uv_const=[1.0, 2.0, 3.0, 4.0, 5.0]
end module tinyconstants
When I try to compile this:
> pgfortran -c tinyconstfail.f90
PGF90-S-0310-Illegal statement in the specification part of a MODULE (tinyconstfail.f90: 6)
0 inform, 0 warnings, 1 severes, 0 fatal for tinyconstants
But, if I try a different method:
module tinyconstants
implicit none
real, dimension(5) :: hk_uv_const=[1.0, 2.0, 3.0, 4.0, 5.0]
end module tinyconstants
and compile:
> pgfortran -c tinyconstwork.f90
No errors!
It’s not exactly hard to use the second style, but why is the first example a violation of the standard?