Skip to content

Commit

Permalink
Merge branch 'jgfouca/fix_shoc_uninit_mem' into master (PR #6799)
Browse files Browse the repository at this point in the history
Fix conditional jump on uninitialized mem in SHOC

The rino temp view only had the nlev-1 entry
initialized. pblintd_height was accessing other entries.

I looked the the F90 impl and it is also doing this strange
initialization of only nlev-1.

This PR will fix valgrind errors for shoc_run_and_cmp that have
appeared on our dashboard. This error seems to go back a long time, so
I don't understand why it only showed up now.

[BFB]
  • Loading branch information
jgfouca committed Dec 5, 2024
2 parents 4b58ed4 + da59a7b commit 25a9e14
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions components/eamxx/src/physics/shoc/impl/shoc_pblintd_impl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,14 @@ void Functions<S,D>::pblintd(

// Initialize
bool check = true;
// The loop below fixes valgrind uninitialized mem errs
#ifndef NDEBUG
for (size_t i=0; i<rino.size(); ++i) {
rino(i)=0;
}
#else
s_rino(nlev-1) = 0;
#endif
pblh = s_z(nlev-1);

// PBL height calculation
Expand Down

0 comments on commit 25a9e14

Please sign in to comment.