I have some code which I am trying to compile with pgfortran 15.1 on 64-bit Linux. However, I am running into a small issue. I’m not sure if it is something I am misunderstanding or what.
In my code I declare a couple of arrays parameters and use them to calculate another parameter. In this calculation, I have to call the real function to convert an array of integers to reals.
However, when the array is declared as a parameter (and initialized inline), the real function call does not iterate through array, but does when the array is without the parameter statement (and initialized in the function).
I’ve written a very simple version of this
program test
implicit none
integer, dimension(2,2), parameter :: vals = &
reshape([ [4, 16], [5, 25] ], [2, 2])
real, dimension(2,2), parameter :: ones = &
reshape([ [1., 1.], [1., 1.] ], [2, 2])
real, dimension(2,2), parameter :: paramarr = ones + real(vals)
real, dimension(2,2) :: testarr
testarr = ones + real(vals)
print *, "Correct output"
print *, 5., 17. 6., 26.
print *, "Without parameter statement"
print *, testarr
print *, "With parameter statement"
print *, paramarr
end program test
And the output I get is
Correct output
5.000000 17.00000 6.000000 26.00000
Without parameter statement
5.000000 17.00000 6.000000 26.00000
With parameter statement
5.000000 5.000000 5.000000 5.000000
Is this something I am misunderstanding or possibly a bug?