Skip to content

Commit 11f8de6

Browse files
committed
Fix amdflang compile bug
1 parent 0a3a7a9 commit 11f8de6

1 file changed

Lines changed: 12 additions & 2 deletions

File tree

src/simulation/m_riemann_solver_hypo_hlld.fpp

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,13 @@ contains
3434

3535
! Local variables:
3636

37-
#:if not MFC_CASE_OPTIMIZATION and USING_AMD
37+
! Hypo HLLD has num_fluids==2 guard -> reads alpha_* at a hard-coded index 2.
38+
! With case-opt, `num_fluids=1` makes dimension(num_fluids) length 1,
39+
! so amdflang gives a compile-time out-of-bounds error. max(num_fluids, 2) fixes it
40+
41+
#:if MFC_CASE_OPTIMIZATION
42+
real(wp), dimension(${max(num_fluids, 2)}$) :: alpha_L, alpha_R, alpha_rho_L, alpha_rho_R
43+
#:elif USING_AMD
3844
real(wp), dimension(3) :: alpha_L, alpha_R, alpha_rho_L, alpha_rho_R
3945
#:else
4046
real(wp), dimension(num_fluids) :: alpha_L, alpha_R, alpha_rho_L, alpha_rho_R
@@ -93,7 +99,11 @@ contains
9399
real(wp) :: rho_hat
94100
real(wp) :: tau_nn_hat, tau_nt_hat, tau_tt_hat, tau_qq_hat
95101
real(wp) :: tau_nt2_hat, tau_t2t2_hat, tau_t1t2_hat
96-
#:if not MFC_CASE_OPTIMIZATION and USING_AMD
102+
! alpha_hat/alpha_rho_hat: same max(num_fluids, 2) reason as alpha_* above
103+
#:if MFC_CASE_OPTIMIZATION
104+
real(wp), dimension(${max(num_fluids, 2)}$) :: alpha_hat, alpha_rho_hat
105+
real(wp), dimension(eqn_idx%stress%end - eqn_idx%stress%beg + 1) :: tau_e_hat
106+
#:elif USING_AMD
97107
real(wp), dimension(3) :: alpha_hat, alpha_rho_hat
98108
real(wp), dimension(6) :: tau_e_hat
99109
#:else

0 commit comments

Comments
 (0)