Skip to content

Fix uninitialized tc_curr causing FIDEAL debug crash - #8647

Open
mt5555 wants to merge 1 commit into
E3SM-Project:masterfrom
mt5555:FIDEAL-bugfix
Open

Fix uninitialized tc_curr causing FIDEAL debug crash#8647
mt5555 wants to merge 1 commit into
E3SM-Project:masterfrom
mt5555:FIDEAL-bugfix

Conversation

@mt5555

@mt5555 mt5555 commented Aug 19, 2026

Copy link
Copy Markdown
Contributor

Fix a crash in FIDEAL debug builds caused by an uninitialized energy diagnostic state field.

Fixes #5294

Description

The energy diagnostic state fields (tc_curr, tc_init, tc_mnst, tc_prev) are allocated with tc_curr set to an Infinity sentinel value, and are normally zeroed out by co2_diags_init(). However, phys_init() returns early for adiabatic/ideal physics configurations (e.g. the FIDEAL compset) before reaching the co2_diags_init() call, leaving tc_curr at Infinity for the entire run.

In debug builds, this trips the shr_assert_in_domain check on state%tc_curr and crashes the run with a segmentation fault during cime_init.

This PR moves the co2_diags_init() call to before the adiabatic/ideal_phys early return in phys_init() so these fields are always initialized, and removes the now-redundant duplicate call further down.

Testing

Tested on Chrysalis (LCRC) with ERP_D_Ld3.ne4pg2_ne4pg2.FIDEAL.chrysalis_gnu.allactive-pioroot1 and ERP_D_Ld3.ne4pg2_ne4pg2.FIDEAL.chrysalis_intel.allactive-pioroot1 (both now PASS; previously failed with a segfault at RUN). Also verified ERP_Ld3.ne4pg2_ne4pg2.FIDEAL.chrysalis_intel.allactive-pioroot1 -c -b master passes and matches the master baseline bit-for-bit, confirming no change in non-debug model behavior.

The energy diagnostic state fields (tc_curr, tc_init, tc_mnst,
tc_prev) are allocated with tc_curr set to an Infinity sentinel value,
and are normally zeroed out by co2_diags_init(). However, phys_init()
returns early for adiabatic/ideal physics configurations (e.g. the
FIDEAL compset) before reaching the co2_diags_init() call, leaving
tc_curr at Infinity for the entire run.

In debug builds, this trips the shr_assert_in_domain check on
state%tc_curr and crashes the run with a segmentation fault during
cime_init.

Move the co2_diags_init() call to before the adiabatic/ideal_phys
early return so these fields are always initialized, and remove the
now-redundant duplicate call further down.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@mt5555
mt5555 requested a review from ndkeen August 19, 2026 21:04
@rljacob rljacob added EAM Fortran-based E3SM Atmosphere Model bug fix PR labels Aug 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug fix PR EAM Fortran-based E3SM Atmosphere Model

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ERROR: shr_assert_in_domain: state%tc_curr has invalid value Infinity with SMS_D_Ld9.ne4_ne4.FIDEAL.pm-cpu_gnu.allactive-pioroot1

3 participants