Bug
simple::orbit_timestep_fo declares ierr as intent(out) but does not assign
it when both fo_step and fo_to_gc return FO_OK.
At src/simple.f90:231-275, every failure/loss branch assigns ierr and
returns. The normal path updates z at lines 272-274 and then returns without
defining ierr.
Reproduction
Call the public wrapper on a valid initialized full-orbit state without relying
on a previous value:
integer :: ierr
call orbit_timestep_fo(fo, z, ierr)
print *, ierr
With a valid axisymmetric Boozer chartmap and a successful first step, a
standalone diagnostic built with GNU Fortran 16.1.1 received an arbitrary
nonzero integer even though the state advanced successfully. Calling the
underlying fo_step followed by fo_to_gc returned FO_OK for the same
state.
The production loop currently tends to mask this because its caller retains an
already-zero status variable. That is not valid for an intent(out) dummy:
the actual argument becomes undefined on entry and the procedure must define
it on every normal return path.
Expected behavior
Set ierr = 0 (or the public success constant, if one is introduced) on the
successful path before returning.
Add a test that initializes ierr to a nonzero sentinel, performs one valid
full-orbit step through orbit_timestep_fo, and requires both successful state
advance and ierr == 0.
Environment and evidence
- SIMPLE revision:
10ac7e76f6159789bf2c38b4386a5fdbc3347bf8
- compiler: GNU Fortran 16.1.1
- source:
src/simple.f90:231-275
No production source change is included in this report.
Bug
simple::orbit_timestep_fodeclaresierrasintent(out)but does not assignit when both
fo_stepandfo_to_gcreturnFO_OK.At
src/simple.f90:231-275, every failure/loss branch assignsierrandreturns. The normal path updates
zat lines 272-274 and then returns withoutdefining
ierr.Reproduction
Call the public wrapper on a valid initialized full-orbit state without relying
on a previous value:
With a valid axisymmetric Boozer chartmap and a successful first step, a
standalone diagnostic built with GNU Fortran 16.1.1 received an arbitrary
nonzero integer even though the state advanced successfully. Calling the
underlying
fo_stepfollowed byfo_to_gcreturnedFO_OKfor the samestate.
The production loop currently tends to mask this because its caller retains an
already-zero status variable. That is not valid for an
intent(out)dummy:the actual argument becomes undefined on entry and the procedure must define
it on every normal return path.
Expected behavior
Set
ierr = 0(or the public success constant, if one is introduced) on thesuccessful path before returning.
Add a test that initializes
ierrto a nonzero sentinel, performs one validfull-orbit step through
orbit_timestep_fo, and requires both successful stateadvance and
ierr == 0.Environment and evidence
10ac7e76f6159789bf2c38b4386a5fdbc3347bf8src/simple.f90:231-275No production source change is included in this report.