https://gcc.gnu.org/bugzilla/show_bug.cgi?id=125174
--- Comment #6 from Richard Biener <rguenth at gcc dot gnu.org> ---
subroutine test(thermal, res, k_pts, P1, P2, P3, g4, dot1, dot2, fac1, a, b)
complex(kind=kind((1.0d0,1.0d0))), dimension(:,:,:), target :: res
complex(kind=kind((1.0d0,1.0d0))), dimension(:), pointer :: res_ij
real(kind=kind(1.0d0)), dimension(:,:), target :: k_pts
real(kind=kind(1.0d0)), dimension(:,:,:), target :: thermal
real(kind=kind(1.0d0)), dimension(:), pointer :: therm,k_x,k_y,k_z
real(kind=kind(1.0d0)) :: g4,dot1,dot2,k1,k2,k3,P1,P2,P3
complex(kind=kind((1.0d0,1.0d0))) :: fac1
integer(kind=kind(1)) :: a,b
k_max = size(k_pts,1)
k_x => k_pts(:,1)
k_y => k_pts(:,2)
k_z => k_pts(:,3)
res_ij => res(:,1,1)
therm => thermal(:,a,b)
do k = 1, k_max
k1 = k_x(k); k2 = k_y(k); k3 = k_z(k)
dot1 = k1*P1+k2*P2+k3*P3
dot2 = g4 * (k1*k1+k2*k2+k3*k3)
res_ij(k) = res_ij(k) + therm(k) * (fac1 *
exp(cmplx(dot2,dot1,kind=kind((1.0d0,1.0d0)))))
end do
end subroutine
does not reproduce the problem, unfortunately. putting back the two outer
loops neither.