Skip to content

Conversation

@Repiteo
Copy link
Contributor

@Repiteo Repiteo commented Oct 17, 2025

CI started to fail for Windows GCC after the Windows Server version bump. This suppression should fix the warnings

@Repiteo Repiteo added this to the 4.6 milestone Oct 17, 2025
@Repiteo Repiteo requested a review from a team October 17, 2025 20:25
@akien-mga
Copy link
Member

That should work, but isn't it a bit much to suppress the whole warning for 500+ lines of code, which could hide actual bugs in the future?

I think explicitly initializing the pointer here should be fine, with something like:

diff --git a/scene/resources/packed_scene.cpp b/scene/resources/packed_scene.cpp
index d3d12fb329..5ceb4c56fb 100644
--- a/scene/resources/packed_scene.cpp
+++ b/scene/resources/packed_scene.cpp
@@ -181,6 +181,7 @@ Node *SceneState::instantiate(GenEditState p_edit_state) const {
 	const NodeData *nd = &nodes[0];
 
 	Node **ret_nodes = (Node **)alloca(sizeof(Node *) * nc);
+	ret_nodes[0] = nullptr;
 
 	bool gen_node_path_cache = p_edit_state != GEN_EDIT_STATE_DISABLED && node_path_cache.is_empty();

The warning for context, from GCC 15.2.0 on Windows:

ERROR: scene\resources\packed_scene.cpp: In member function 'Node* SceneState::instantiate(GenEditState) const':
scene\resources\packed_scene.cpp:702:27: error: '*ret_nodes' may be used uninitialized [-Werror=maybe-uninitialized]
  702 |         return ret_nodes[0];
      |                           ^
cc1plus.exe: all warnings being treated as errors

It does seem a priori like a false positive.

@Repiteo Repiteo force-pushed the core/suppress-gcc-false-positive branch from 74e1eb7 to 99c06e6 Compare October 17, 2025 20:39
@Repiteo
Copy link
Contributor Author

Repiteo commented Oct 17, 2025

Yeah, that should be fine as well. I'll go with that instead

@Repiteo Repiteo force-pushed the core/suppress-gcc-false-positive branch from 99c06e6 to fc54f40 Compare October 17, 2025 20:41
@Repiteo Repiteo changed the title Core: Suppress GCC false-positive Core: Sidestep GCC false-positive Oct 17, 2025
@Repiteo Repiteo force-pushed the core/suppress-gcc-false-positive branch from fc54f40 to acdb866 Compare October 17, 2025 23:57
@akien-mga akien-mga merged commit 816ec99 into godotengine:master Oct 18, 2025
20 checks passed
@akien-mga
Copy link
Member

Thanks!

@akien-mga akien-mga added cherrypick:3.x Considered for cherry-picking into a future 3.x release cherrypick:3.6 Considered for cherry-picking into a future 3.6.x release cherrypick:4.4 Considered for cherry-picking into a future 4.4.x release cherrypick:4.5 Considered for cherry-picking into a future 4.5.x release labels Oct 18, 2025
@Repiteo Repiteo deleted the core/suppress-gcc-false-positive branch October 18, 2025 13:04
@akien-mga akien-mga removed cherrypick:3.x Considered for cherry-picking into a future 3.x release cherrypick:3.6 Considered for cherry-picking into a future 3.6.x release labels Oct 22, 2025
@akien-mga
Copy link
Member

Cherry-picked for 4.5 and 4.4 via #112103 and #112104.

@akien-mga akien-mga removed the cherrypick:4.4 Considered for cherry-picking into a future 4.4.x release label Oct 27, 2025
@akien-mga akien-mga removed the cherrypick:4.5 Considered for cherry-picking into a future 4.5.x release label Oct 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants