Skip to content

Commit e796286

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 <[email protected]>
1 parent c962ad2 commit e796286

File tree

3 files changed

+9
-1
lines changed

3 files changed

+9
-1
lines changed

core/io/image.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2336,6 +2336,10 @@ void Image::initialize_data(const char **p_xpm) {
23362336
} break;
23372337
case READING_PIXELS: {
23382338
int y = line - colormap_size - 1;
2339+
#if defined(__GNUC__) && !defined(__clang__)
2340+
#pragma GCC diagnostic push
2341+
#pragma GCC diagnostic warning "-Wstringop-overflow=0"
2342+
#endif
23392343
for (int x = 0; x < size_width; x++) {
23402344
char pixelstr[6] = { 0, 0, 0, 0, 0, 0 };
23412345
for (int i = 0; i < pixelchars; i++) {
@@ -2350,6 +2354,9 @@ void Image::initialize_data(const char **p_xpm) {
23502354
}
23512355
_put_pixelb(x, y, pixel_size, data_write, pixel);
23522356
}
2357+
#if defined(__GNUC__) && !defined(__clang__)
2358+
#pragma GCC diagnostic pop
2359+
#endif
23532360

23542361
if (y == (size_height - 1)) {
23552362
status = DONE;

core/object/message_queue.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ class MessageQueue {
5555

5656
struct Message {
5757
Callable callable;
58-
int16_t type;
58+
int16_t type = 0;
5959
union {
6060
int16_t notification;
6161
int16_t args;

scene/resources/packed_scene.cpp

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

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

108109
bool gen_node_path_cache = p_edit_state != GEN_EDIT_STATE_DISABLED && node_path_cache.is_empty();
109110

0 commit comments

Comments
 (0)