1! { dg-do compile }
2! { dg-options "-floop-nest-optimize -O2 -ffast-math" }
3! PR53852 : compile time / memory hog
4SUBROUTINE  build_d_tensor_gks(d5f,v,d5)
5    INTEGER, PARAMETER :: dp=8
6    REAL(KIND=dp),  DIMENSION(3, 3, 3, 3, 3), &
7      INTENT(OUT) :: d5f
8    REAL(KIND=dp), DIMENSION(3), INTENT(IN)  :: v
9    REAL(KIND=dp), INTENT(IN) :: d5
10    INTEGER       :: k1, k2, k3, k4, k5
11    REAL(KIND=dp) :: w
12
13    d5f = 0.0_dp
14    DO k1=1,3
15       DO k2=1,3
16          DO k3=1,3
17             DO k4=1,3
18                DO k5=1,3
19                   d5f(k5,k4,k3,k2,k1)=d5f(k5,k4,k3,k2,k1)+ &
20                          v(k1)*v(k2)*v(k3)*v(k4)*v(k5)*d5
21                ENDDO
22                w=v(k1)*v(k2)*v(k3)*d4
23                d5f(k1,k2,k3,k4,k4)=d5f(k1,k2,k3,k4,k4)+w
24                d5f(k1,k2,k4,k3,k4)=d5f(k1,k2,k4,k3,k4)+w
25                d5f(k1,k4,k2,k3,k4)=d5f(k1,k4,k2,k3,k4)+w
26                d5f(k4,k1,k2,k3,k4)=d5f(k4,k1,k2,k3,k4)+w
27                d5f(k1,k2,k4,k4,k3)=d5f(k1,k2,k4,k4,k3)+w
28                d5f(k1,k4,k2,k4,k3)=d5f(k1,k4,k2,k4,k3)+w
29                d5f(k4,k1,k2,k4,k3)=d5f(k4,k1,k2,k4,k3)+w
30                d5f(k1,k4,k4,k2,k3)=d5f(k1,k4,k4,k2,k3)+w
31                d5f(k4,k1,k4,k2,k3)=d5f(k4,k1,k4,k2,k3)+w
32                d5f(k4,k4,k1,k2,k3)=d5f(k4,k4,k1,k2,k3)+w
33             ENDDO
34          ENDDO
35       ENDDO
36    ENDDO
37END SUBROUTINE build_d_tensor_gks
38