Summary
In src/simulation/m_pressure_relaxation.fpp, the non-case-optimization AMD branch (#:if not MFC_CASE_OPTIMIZATION and USING_AMD) declares local arrays with a hardcoded upper bound of 2:
#:if not MFC_CASE_OPTIMIZATION and USING_AMD
real(wp), dimension(2) :: alpha_rho, alpha
#:else
real(wp), dimension(num_fluids) :: alpha_rho, alpha
#:endif
These arrays are then written inside a loop up to num_fluids:
do i = 1, num_fluids
alpha_rho(i) = q_cons_vf(i)%sf(j, k, l)
alpha(i) = q_cons_vf(eqn_idx%E + i)%sf(j, k, l)
end do
Impact
When num_fluids > 2 in an AMD GPU build without case optimization, both arrays overflow. The existing PROHIBIT checks do not specifically guard num_fluids <= 2 on AMD paths.
(Note: m_cbc.fpp has a similar AMD-specific hardcoded-dimension pattern but uses dimension(3) there.)
Fix
Replace the hardcoded dimension(2) with dimension(max(2, num_fluids)) or add a @:PROHIBIT(num_fluids > 2 ...) guard, or use the same dimension(num_fluids) path as non-AMD.
Discovered
Found during review of PR #1365. Pre-existing in master.
Summary
In
src/simulation/m_pressure_relaxation.fpp, the non-case-optimization AMD branch (#:if not MFC_CASE_OPTIMIZATION and USING_AMD) declares local arrays with a hardcoded upper bound of 2:These arrays are then written inside a loop up to
num_fluids:Impact
When
num_fluids > 2in an AMD GPU build without case optimization, both arrays overflow. The existing PROHIBIT checks do not specifically guardnum_fluids <= 2on AMD paths.(Note:
m_cbc.fpphas a similar AMD-specific hardcoded-dimension pattern but usesdimension(3)there.)Fix
Replace the hardcoded
dimension(2)withdimension(max(2, num_fluids))or add a@:PROHIBIT(num_fluids > 2 ...)guard, or use the samedimension(num_fluids)path as non-AMD.Discovered
Found during review of PR #1365. Pre-existing in
master.