Skip to content

Commit e69ab66

Browse files
Repiteoakien-mga
andcommitted
Core: Sidestep GCC false-positives
(cherry picked from commit acdb866) Adds some more fixes for 4.5. Co-authored-by: Rémi Verschelde <rverschelde@gmail.com>
1 parent 61adafa commit e69ab66

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

core/io/image.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2338,6 +2338,10 @@ void Image::initialize_data(const char **p_xpm) {
23382338
} break;
23392339
case READING_PIXELS: {
23402340
int y = line - colormap_size - 1;
2341+
#if defined(__GNUC__) && !defined(__clang__)
2342+
#pragma GCC diagnostic push
2343+
#pragma GCC diagnostic warning "-Wstringop-overflow=0"
2344+
#endif
23412345
for (int x = 0; x < size_width; x++) {
23422346
char pixelstr[6] = { 0, 0, 0, 0, 0, 0 };
23432347
for (int i = 0; i < pixelchars; i++) {
@@ -2352,6 +2356,9 @@ void Image::initialize_data(const char **p_xpm) {
23522356
}
23532357
_put_pixelb(x, y, pixel_size, data_write, pixel);
23542358
}
2359+
#if defined(__GNUC__) && !defined(__clang__)
2360+
#pragma GCC diagnostic pop
2361+
#endif
23552362

23562363
if (y == (size_height - 1)) {
23572364
status = DONE;

scene/resources/packed_scene.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,7 @@ Node *SceneState::instantiate(GenEditState p_edit_state) const {
108108
const NodeData *nd = &nodes[0];
109109

110110
Node **ret_nodes = (Node **)alloca(sizeof(Node *) * nc);
111+
ret_nodes[0] = nullptr; // Sidesteps "maybe uninitialized" false-positives on GCC.
111112

112113
bool gen_node_path_cache = p_edit_state != GEN_EDIT_STATE_DISABLED && node_path_cache.is_empty();
113114

0 commit comments

Comments
 (0)