eamxx: fix uninit var warnings#8484
Merged
Merged
Conversation
Copilot
AI
changed the title
[WIP] Fix uninitialized variable warnings in C++
eamxx: fix uninit var warnings
Jun 17, 2026
bartgol
approved these changes
Jun 17, 2026
Initialize fail_handling_type and lev to safe defaults to suppress -Wsometimes-uninitialized in atmosphere_driver.cpp. Initialize data = nullptr in field_pyutils.hpp switch default case. Change KOKKOS_FUNCTION to KOKKOS_INLINE_FUNCTION for calc_vel_horiz_formula_node_ref_mid and calc_eta_dot_formula_node_ref_int in ComposeTransportImplEnhancedTrajectoryImpl.hpp to suppress -Wunused-function when included in translation units that don't call these functions.
7d88b17 to
c5c7b55
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes
-Wsometimes-uninitializedand-Wunused-functioncompiler warnings that can produce undefined behavior depending on control flow.Changes
atmosphere_driver.cpp: Initializefail_handling_typetoCheckFailHandling::WarningandlevtoLogLevel::infoat declaration so the compiler can confirm they are always initialized before use, even though theelsebranches callEKAT_ERROR_MSG.field_pyutils.hpp: Initializedata = nullptr; the switch has no default assignment, leavingdatauninitialized if an unrecognized type reaches thepy::array(...)call.ComposeTransportImplEnhancedTrajectoryImpl.hpp: ChangeKOKKOS_FUNCTION→KOKKOS_INLINE_FUNCTIONforcalc_vel_horiz_formula_node_ref_midandcalc_eta_dot_formula_node_ref_int. Both functions are used inComposeTransportImplEnhancedTrajectory.cpp, but the header is also included by the test TU which does not call them —inlinesuppresses the per-TU unused-function diagnostic.