https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84499
Bug ID: 84499 Summary: [8 Regression] ICE on cp2k in rs6000_emit_le_vsx_store starting with r256656 Product: gcc Version: 8.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: target Assignee: unassigned at gcc dot gnu.org Reporter: jakub at gcc dot gnu.org Target Milestone: --- Following testcase ICEs starting with r256656 with: -O1 -fstack-protector-strong -mcpu=power8 on powerpc64le-linux. MODULE rh1546743 PRIVATE PUBLIC :: foo INTEGER, PARAMETER :: dp = SELECTED_REAL_KIND(14, 200) INTEGER, PARAMETER :: int_8 = SELECTED_INT_KIND(10) COMPLEX(KIND=dp), PARAMETER :: gaussi = (0.0_dp, 1.0_dp) REAL(KIND=dp), PARAMETER :: twopi = 6.28318530717958647692528677_dp INTEGER, DIMENSION(:, :, :), ALLOCATABLE :: coset INTEGER, DIMENSION(:), ALLOCATABLE :: ncoset CONTAINS SUBROUTINE foo(S_G, hmat, h_inv, vol, G_bounds_1, R_bounds_2, order) REAL(KIND=dp), DIMENSION(3, 3), INTENT(IN) :: hmat, h_inv REAL(KIND=dp), INTENT(IN) :: vol REAL(KIND=dp), DIMENSION(3, 3), INTENT(IN) :: G_bounds_1, R_bounds_2 INTEGER :: l_max, sum_method, sum_order REAL(KIND=dp) :: alpha, beta, G_rad, gamma, R_rad REAL(KIND=dp), ALLOCATABLE, DIMENSION(:, :, :) :: S_G_tmp REAL(KIND=dp), DIMENSION(3) :: G_bound, R1, R2, R_bound SELECT CASE (sum_method) CASE (1) SELECT CASE (sum_order) CASE (1) CALL bar(S_G_tmp, l_max, m_max, n_max, R1, R2, alpha, beta, & gamma, hmat, h_inv, vol, R_bound, G_bound, R_rad, G_rad) CALL bar(S_G_tmp, n_max, m_max, l_max, -R2, -R1, gamma, beta, & alpha, hmat, h_inv, vol, R_bound, G_bound, R_rad, G_rad) END SELECT END SELECT END SUBROUTINE foo PURE SUBROUTINE bar(S_G, l_max, m_max, n_max, R1, R2, alpha, beta, gamma, & hmat, h_inv, vol, R_c, G_c, R_rad, G_rad) REAL(KIND=dp), DIMENSION(:, :, :), INTENT(OUT) :: S_G INTEGER, INTENT(IN) :: l_max, m_max, n_max REAL(KIND=dp), DIMENSION(3), INTENT(IN) :: R1, R2 REAL(KIND=dp), INTENT(IN) :: alpha, beta, gamma REAL(KIND=dp), DIMENSION(3, 3), INTENT(IN) :: hmat, h_inv REAL(KIND=dp), INTENT(IN) :: vol REAL(KIND=dp), DIMENSION(3), INTENT(IN) :: R_c, G_c REAL(KIND=dp), INTENT(IN) :: R_rad, G_rad COMPLEX(KIND=dp), DIMENSION(ncoset(m_max), ncoset(n_max)) :: S_R COMPLEX(KIND=dp), DIMENSION(ncoset(l_max), ncoset(m_max), ncoset(n_max)) :: S_G_c REAL(KIND=dp) :: G_rad_sq, R_rad_sq REAL(KIND=dp), DIMENSION(3) :: G, G_y, G_z REAL(KIND=dp), DIMENSION(3, 3) :: ht INTEGER :: gx, gy, gz, k DO gx = -FLOOR(G_c(1)), FLOOR(G_c(1)) DO gy = -FLOOR(G_c(2)), FLOOR(G_c(2)) G_y = ht(:, 2)*gy DO gz = -FLOOR(G_c(3)), FLOOR(G_c(3)) DO k = 1, 3 DO l = 1, l_max ENDDO ENDDO CALL baz(S_R, m_max, n_max, G, R2, beta, gamma, hmat, h_inv, vol, R_c, R_rad_sq) DO lco = 1, ncoset(l_max) ENDDO DO nco = 1, ncoset(n_max) DO mco = 1, ncoset(m_max) DO lco = 1, ncoset(l_max) S_G_c(lco, mco, nco) = exp_tot*i_pow(l+m+n)*(-1.0_dp)**m*S_R(mco, nco) ENDDO ENDDO ENDDO ENDDO ENDDO ENDDO END SUBROUTINE bar PURE SUBROUTINE baz(S_R, l_max, m_max, G, R, alpha, beta, hmat, h_inv, vol, R_c, R_rad_sq) COMPLEX(KIND=dp), DIMENSION(:, :), INTENT(OUT) :: S_R INTEGER, INTENT(IN) :: l_max, m_max REAL(KIND=dp), DIMENSION(3), INTENT(IN) :: G, R REAL(KIND=dp), INTENT(IN) :: alpha, beta REAL(KIND=dp), DIMENSION(3, 3), INTENT(IN) :: hmat, h_inv REAL(KIND=dp), INTENT(IN) :: vol REAL(KIND=dp), DIMENSION(3), INTENT(IN) :: R_c REAL(KIND=dp), INTENT(IN) :: R_rad_sq INTEGER :: k, t, tz, sx, tx, ty COMPLEX(KIND=dp), DIMENSION(ncoset(l_max+m_max)) :: S_R_t REAL(KIND=dp), DIMENSION(-1:l_max+m_max+1, -1:l_max, -1:m_max) :: E1, E2, E3 REAL(KIND=dp), DIMENSION(3) :: R_l, R_r, Rp, Rx, Ry, Rz, s_shift REAL(KIND=dp), DIMENSION(3, 0:l_max+m_max) :: R_pow_t INTERFACE PURE SUBROUTINE boo(l, m, a, b, R1, R2, H_or_C_product, E) INTEGER, PARAMETER :: dp = SELECTED_REAL_KIND(14, 200) INTENT(IN) :: l, m REAL(KIND=dp), INTENT(IN) :: a, b, R1, R2 INTEGER, INTENT(IN) :: H_or_C_product REAL(KIND=dp), DIMENSION(-1:l+m+1, -1:m), INTENT(OUT) :: E END SUBROUTINE END INTERFACE s_shift = MATMUL(h_inv, R) R_l = -R_c+s_shift DO sx = CEILING(R_l(1)), FLOOR(R_r(1)) Rx = hmat(:, 1)*sx DO sy = CEILING(R_l(2)), FLOOR(R_r(2)) Ry = hmat(:, 2)*sy DO sz = CEILING(R_l(3)), FLOOR(R_r(3)) Rz = hmat(:, 3)*sz exp_tot = EXP(-c1*Rp_sq)*EXP(-gaussi*c2*DOT_PRODUCT(Rp, G)) DO k = 1, 3 R_pow_t(k, 0) = 1.0_dp DO t = 1, l_max+m_max ENDDO ENDDO DO tco = 1, ncoset(l_max+m_max) S_R_t(tco) = S_R_t(tco)+(-1.0_dp)**t*i_pow(t)*exp_tot ENDDO ENDDO ENDDO ENDDO CALL boo(l_max, m_max, alpha, beta, G(3), 0.0_dp, 1, E3) DO mco = 1, ncoset(m_max) DO lco = 1, ncoset(l_max) DO tx = 0, lx+mx DO ty = 0, ly+my DO tz = 0, lz+mz S_R(lco, mco) = S_R(lco, mco)+E1(tx, lx, mx)*E2(ty, ly, my)*E3(tz, lz, mz)*S_R_t(tco) ENDDO ENDDO ENDDO ENDDO ENDDO END SUBROUTINE baz PURE ELEMENTAL FUNCTION i_pow(i) INTEGER, INTENT(IN) :: i END FUNCTION END MODULE rh1546743