NVFORTRAN-S-0155-Intrinsic not supported in initialization: log_gamma

Hi !
within the following environment:

$ uname -srvm ; nvfortran --version
Linux 6.1.0-18-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.76-1 (2024-02-01) x86_64
nvfortran 24.3-0 64-bit target on x86-64 Linux -tp tigerlake

I get the error in the title when compiling the following definition

program event
    use, intrinsic :: iso_fortran_env, only: pr => real64
    integer, parameter   :: NP = 3 !< Number of generated impulsions
    real (pr), parameter :: one = 1, & ! zero = 0, two = 2, half = one / two,
           TWOPI  = 2 * acos (-one), & ! 2𝜋
           PO2LOG = log (TWOPI / 4)   ! ln (𝜋/2)
    integer   ::  K !> Dummy loop variables
    real (pr), dimension (2:NP), parameter :: Z = [ ( &
           ((k-1) * PO2LOG - log_gamma (real (k-1, pr)) - log (real (k-1, pr))), k = 2, NP) ]

    print *, Z
end program event

Compilation fails as follows:

$ nvfortran factorial.f90 && ./a.out
NVFORTRAN-S-0155-Intrinsic not supported in initialization: log_gamma (factorial.f90: 8)
…

This kind of initialization is a modernization of legacy code that works with gfortran and ifx. I can bypass the problem with conditional compilation and a SAVEd array initialized at run time in a module, but log_gamma and gamma would be really nice intrinsics to have for initialization.

Best,
V

Hi V,

We don’t support all intrinsics for use within initialization statements, but I’ve added an request, TPR #35559, and we can see if engineering can add “log_gamma”.

Thanks!
Mat

Thanks !
V