You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Model%nto and Model%nto2 are only initialized if the CPP directive MULTI_GASES is set. But these variables always exist (see lines 1490-1491) and therefore remain uninitialized.
In lines 5398-5399, they are used to set up the label_dtend_tracer array if ldiag3d is true. Since ldiag3d can be true without MULTI_GASES being set, it looks like uninitialized values of nto and nto2 are passed to that routine. Unless I am not seeing it. Depending on the system you are on, this can have bad consequences. Example: on my laptop and on Nautilus (a DoD Penguin Linux system), they both always have value zero. That results in double free memory corruption errors later in the add_dtend calls. On Narwhal (a DoD Cray system), they have very large but different integer values that result in out of bounds errors. This is with NEPTUNE and not with the UFS, but if I read the code in GFS_typedefs correctly, the bug seems to be there, too?
The text was updated successfully, but these errors were encountered:
@DusanJovic-NOAA@SamuelTrahanNOAA I'd appreciate if you could take a look at this. If what I am saying above is correct, then I don't understand why you are not getting these double free or out of bounds errors. Thanks!
If you call get_tracer_index for them (as I think you should), then they get value NO_TRACERS = -99, which then, together with your label_dtend_tracer logic, means they are skipped (index + 100 --> if <2 ignore) ?
See
fv3atm/ccpp/data/GFS_typedefs.F90
Line 5181 in a936459
Model%nto
andModel%nto2
are only initialized if the CPP directiveMULTI_GASES
is set. But these variables always exist (see lines 1490-1491) and therefore remain uninitialized.In lines 5398-5399, they are used to set up the
label_dtend_tracer
array ifldiag3d
is true. Sinceldiag3d
can be true withoutMULTI_GASES
being set, it looks like uninitialized values ofnto
andnto2
are passed to that routine. Unless I am not seeing it. Depending on the system you are on, this can have bad consequences. Example: on my laptop and on Nautilus (a DoD Penguin Linux system), they both always have value zero. That results in double free memory corruption errors later in theadd_dtend
calls. On Narwhal (a DoD Cray system), they have very large but different integer values that result in out of bounds errors. This is with NEPTUNE and not with the UFS, but if I read the code inGFS_typedefs
correctly, the bug seems to be there, too?The text was updated successfully, but these errors were encountered: