From 0f77b5c9dfac44ff6eff8fb66fefadea72846c97 Mon Sep 17 00:00:00 2001 From: Mingli Yu Date: Thu, 12 Mar 2020 11:42:07 +0800 Subject: [PATCH] Fix: src.ctf.fs: initialize the other_entry variable Initialize the pointer other_entry to silence this warning: | ../../../../../git/src/plugins/ctf/fs-src/fs.c: In function 'ds_index_insert_ds_index_entry_sorted': | ../../../../../git/src/plugins/ctf/fs-src/fs.c:702:5: error: 'other_entry' may be used uninitialized in this function [-Werror=maybe-uninitialized] | 702 | !ds_index_entries_equal(entry, other_entry)) { This was encountered with gcc 9.2.0 at the -Og optimization level. After inspection, it appears that this is a false positive, the `other_entry` pointer can only be used after being initialized first. Signed-off-by: Mingli Yu Change-Id: Icf63e605cf543c3eb29e5aadec18b22b137ee9da Reviewed-on: https://review.lttng.org/c/babeltrace/+/3353 CI-Build: Simon Marchi Reviewed-by: Philippe Proulx Tested-by: jenkins --- src/plugins/ctf/fs-src/fs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/ctf/fs-src/fs.c b/src/plugins/ctf/fs-src/fs.c index e87523a3..a6b5315f 100644 --- a/src/plugins/ctf/fs-src/fs.c +++ b/src/plugins/ctf/fs-src/fs.c @@ -680,7 +680,7 @@ void ds_index_insert_ds_index_entry_sorted( struct ctf_fs_ds_index_entry *entry) { guint i; - struct ctf_fs_ds_index_entry *other_entry; + struct ctf_fs_ds_index_entry *other_entry = NULL; /* Find the spot where to insert this index entry. */ for (i = 0; i < index->entries->len; i++) { -- 2.34.1