https://gcc.gnu.org/bugzilla/show_bug.cgi?id=125568

--- Comment #1 from Ivan Pribec <ivan.pribec at gmail dot com> ---
I realized the example can be reduced, 

! factorial_power_mwe.f90 -- Reproducer for GCC bugzilla
! Tests parameter array initialisation via implied-do.
!
! The falling factorial (descending factorial, Pochhammer symbol) is:
!   (x)_n = x * (x - 1) * ... * (x - n + 1)     ! product of n terms
! with the convention (x)_0 = 1 (empty product).
program factorial_power
implicit none
integer, parameter :: nmax = 12
integer :: ic, j, k, fact
integer, parameter :: c(0:nmax, 0:nmax) = &
    reshape([((product([(ic, ic=j-k+1, j)]), j=0, nmax), k=0, nmax )], &
        shape=[nmax+1, nmax+1])
! Property 1: (j)_j = j!  (diagonal of table equals factorial)
fact = 1
do j = 0, nmax
    if (j > 0) fact = fact * j
    if (c(j, j) /= fact) error stop 1
end do
! Property 2: recurrence  (j)_k = (j)_{k-1} * (j - k + 1)  for 1 <= k <= j
do j = 1, nmax
    do k = 1, j
        if (c(j, k) /= c(j, k-1) * (j - k + 1)) &
            error stop 2
    end do
end do
end program

I also tried replacing [ ] with (/ /), but to no avail.

Reply via email to