Location: subsample_and_optics_example/optics/quickbeam_optics/optics_lib.F90, m_ice, line 542 (master 5eb05e5):
if (alam < cutice) then
! Region from 0.045 microns to 167.0 microns - no temperature depend
do i=2,nwl
if(alam < wl(i)) continue
enddo
x1 = log(wl(i-1))
In Fortran, continue is a no-op statement (not C's loop-continue), so this loop does nothing and always completes with i = nwl+1. The subsequent tabre(i) / wl(i) references then read one past the end of the nwl-sized arrays (silent out-of-bounds without -fcheck=bounds), and the interpolation uses the wrong bracket regardless.
The intended behaviour is clearly "find the first i with wl(i) > alam" (an exit instead of continue, or an infind-style search like the microwave branch below it).
Impact: latent for CloudSat use — at 94 GHz, alam = 3e5/94 ≈ 3191 um > cutice = 167 um, so only the temperature-dependent microwave branch executes. Any frequency above ~1.8 THz (or other reuse of m_ice at short wavelengths) would hit the broken branch.
Found while building a JAX translation of COSP (jax-cosp); its port implements the intended bracketing.
Location:
subsample_and_optics_example/optics/quickbeam_optics/optics_lib.F90,m_ice, line 542 (master5eb05e5):In Fortran,
continueis a no-op statement (not C's loop-continue), so this loop does nothing and always completes withi = nwl+1. The subsequenttabre(i)/wl(i)references then read one past the end of the nwl-sized arrays (silent out-of-bounds without-fcheck=bounds), and the interpolation uses the wrong bracket regardless.The intended behaviour is clearly "find the first
iwithwl(i) > alam" (anexitinstead ofcontinue, or aninfind-style search like the microwave branch below it).Impact: latent for CloudSat use — at 94 GHz,
alam = 3e5/94 ≈ 3191 um > cutice = 167 um, so only the temperature-dependent microwave branch executes. Any frequency above ~1.8 THz (or other reuse ofm_iceat short wavelengths) would hit the broken branch.Found while building a JAX translation of COSP (jax-cosp); its port implements the intended bracketing.