Bug
s_ibm_correct_state (src/simulation/m_ibm.fpp:143) declares pb_in/mv_in as optional:
real(stp), dimension(...), optional, intent(inout) :: pb_in, mv_in
but m_ibm.fpp contains zero present() calls. The routine uses them unconditionally. One of
its two call sites omits them (m_time_steppers.fpp:556):
if (qbmm .and. .not. polytropic) then
call s_ibm_correct_state(q_cons_ts(1)%vf, q_prim_vf, pb_ts(1)%sf, mv_ts(1)%sf)
else
call s_ibm_correct_state(q_cons_ts(1)%vf, q_prim_vf) ! absent optionals
end if
That path is undefined behaviour. It happens to survive on some compilers; on Cray CCE 21 the
absent dummy presents a null dope vector to the device data environment and the run segfaults
(exit 139) on every IBM test.
Fix
pb_ts(1)%sf is always allocated — m_time_steppers.fpp allocates it in both branches
(full size when QBMM, beg:beg+1 otherwise), both with ACC_SETUP_SFs, and deallocates it
unconditionally. So it can be passed unconditionally:
- drop
optional from pb_in/mv_in in m_ibm.fpp:143
- replace the
if/else at m_time_steppers.fpp:553 with the single call
This is a net simplification (−4 lines) and removes the branch rather than making the absent
case survivable. Safe because the writes at m_ibm.fpp:437-438 are already guarded by
if (qbmm) / if (.not. polytropic), so the small non-QBMM allocation is never indexed.
Verification
Frontier (MI250X), CCE 21.0.2 / ROCm 7.2.0, full 627-test suite: zero exit-139 segfaults
after this change, where the IBM tests previously aborted. Found independently by two sessions.
Related
There is a second routine with the same shape that is not covered by this fix:
s_interpolate_image_point (m_ibm.fpp:807) has nine optional array dummies, and its call
sites pass different subsets — e.g. m_ibm.fpp:251 passes one and omits nine. That is a
suspect for a remaining IBM fault and should be audited the same way.
Bug
s_ibm_correct_state(src/simulation/m_ibm.fpp:143) declarespb_in/mv_inasoptional:but
m_ibm.fppcontains zeropresent()calls. The routine uses them unconditionally. One ofits two call sites omits them (
m_time_steppers.fpp:556):That path is undefined behaviour. It happens to survive on some compilers; on Cray CCE 21 the
absent dummy presents a null dope vector to the device data environment and the run segfaults
(exit 139) on every IBM test.
Fix
pb_ts(1)%sfis always allocated —m_time_steppers.fppallocates it in both branches(full size when QBMM,
beg:beg+1otherwise), both withACC_SETUP_SFs, and deallocates itunconditionally. So it can be passed unconditionally:
optionalfrompb_in/mv_ininm_ibm.fpp:143if/elseatm_time_steppers.fpp:553with the single callThis is a net simplification (−4 lines) and removes the branch rather than making the absent
case survivable. Safe because the writes at
m_ibm.fpp:437-438are already guarded byif (qbmm)/if (.not. polytropic), so the small non-QBMM allocation is never indexed.Verification
Frontier (MI250X), CCE 21.0.2 / ROCm 7.2.0, full 627-test suite: zero exit-139 segfaults
after this change, where the IBM tests previously aborted. Found independently by two sessions.
Related
There is a second routine with the same shape that is not covered by this fix:
s_interpolate_image_point(m_ibm.fpp:807) has nine optional array dummies, and its callsites pass different subsets — e.g.
m_ibm.fpp:251passes one and omits nine. That is asuspect for a remaining IBM fault and should be audited the same way.