Fortran: sum not allowed for parameter initialization

The following program should be valid but does not compile with PGI 19.10 on linux:

program sum_init

    implicit none
    real, dimension(2), parameter :: a = [1,2]
    real, parameter               :: s = sum(a)

end program sum_init

the error is

PGF90-S-0155-Intrinsic not supported in initialization: sum (sum_init.f90: 5)
  0 inform,   0 warnings,   1 severes, 0 fatal for sum_init

Note that I’m not sure whether this is valid F03 code or if only newer standard (F08 or even F18) allow this.

Hi Martin,

Note that I’m not sure whether this is valid F03 code or if only newer standard (F08 or even F18) allow this.

I’m not sure either. Though, it looks like both gfortran and ifort compile the code successfully, so we probably should as well. Hence, I’ve added a request for enhancement (RFE) and logged it as TPR#27995.

-Mat

I am getting the same error but for transpose on 19.10:

PGF90-S-0155-Intrinsic not supported in initialization: transpose

It is known to work on gfortran gcc 7.5

Thanks Kurt. I’ve added your request to TPR #27995 as well.

-Mat