Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ice_calendar: zero-initialize 'nstreams' #752

Merged
merged 1 commit into from
Aug 17, 2022

Commits on Aug 17, 2022

  1. ice_calendar: zero-initialize 'nstreams'

    The variable ice_calendar::nstreams, which corresponds to the number of
    output history streams to use for the run, is initialized in
    ice_history::init_hist depending on the number of non-'x' elements in
    'histfreq' in the namelist.
    
    However, the code does use 'nstreams' before ice_history::init_hist is
    called, in ice_calendar::calendar when called from
    ice_calendar::init_calendar. Both 'init_calendar' and 'init_hist' are
    called from CICE_InitMod::cice_init, in that order, such that the loop
    that initializes 'write_history' in 'calendar' uses 'nstreams'
    uninitialized.
    
    'calendar' ends up being called at least once more during 'cice_init', from
    ice_calendar::advance_timestep, at which point 'nstreams' is correctly
    defined and 'write_history' is thus correctly initialized, before its
    first use in 'accum_hist'.
    
    To avoid using 'nstreams' uninitialized in the first call to 'calendar'
    from 'init_calendar', initialize it to zero in 'init_calendar' before
    calling 'calendar'.
    
    This issue was discovered by compiling using the '-init=huge' flag of
    the Intel compiler.
    phil-blain committed Aug 17, 2022
    Configuration menu
    Copy the full SHA
    15ce4d4 View commit details
    Browse the repository at this point in the history