phil-blain / CICE

Development repository for the CICE sea-ice model
Other
0 stars 0 forks source link

`nstreams` used before being initialized (compiling with `-init=huge`) #43

Closed phil-blain closed 2 years ago

phil-blain commented 2 years ago

nstreams is initialized in ice_history::init_hist, but is used in ice_calendar::calendar, called from ice_calendar::init_calendar. The calling sequence in CICE_InitMod::cice_init is:

132           call init_calendar        ! initialize some calendar stuff
133           call init_hist (dt)       ! initialize output history file

So it's used before being initialized. This was found by compiling with -init=huge which initializes integers to their maximum value; nstreams was 2147483647 in the core dump and the model aborted because histfreq was accessed at index 6 while it has size 5 (thanks to -check).

Might be worth it to run the full suite with that flag, see what we uncover!

phil-blain commented 2 years ago

So it seems -init=huge,arrays still initializes reals to NaN, so it's hard to see if we uncover new bugs just due to huge. I'll try with just huge.

phil-blain commented 2 years ago

No new failures with just -init=huge. I've fixed the above in 584f370 and I'll open a PR for that.

phil-blain commented 2 years ago

PR merged: https://github.com/CICE-Consortium/CICE/pull/752