Description
Describe the bug
The VS
and VD
variables are not being properly initialised in w3srcemd.
Unfortunately, the compiler never complains about because it looks like they are being set with values here:
Lines 1446 to 1448 in 3eb8161
However, the loop is through IS1
to NSPECH
, which are not necessarily the same as 1 and NSPEC
respectively.
This means there are potentially some array elements that are unilitialised
The next time that VD is used (in the PDLIB versions of ww3_tp2.21
at least) is in the source term increment loop here:
Lines 1562 to 1566 in 3eb8161
which is looping over the whole spectrum (IK
and ITH
).
To Reproduce
Compiled and run ww3_tp2.21 regtests with -finit-real=snan
This initialises all real variables to signalling NaN values (which should cause a crash).
Expected behavior
Regtest should crash (it did with GNU compiler) complainig about invalid values in VD around line 1566.