[PATCH 2/2] DONTAPPLY: -Os fallout workaround

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



These "workarounds" are to mark variables that are used after
initialized, but some compilers with lower optimization levels
cannot see and report "used uninitialized".

This set targets "gcc-13 -Os".  For the reason why this is a wrong
thing to do for longer-term code health, see

  https://lore.kernel.org/git/xmqqed946auc.fsf@gitster.g/

Signed-off-by: Junio C Hamano <gitster@xxxxxxxxx>
---
 builtin/fast-import.c   | 2 +-
 compat/linux/procinfo.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/builtin/fast-import.c b/builtin/fast-import.c
index 6d53e42011..109b0facd5 100644
--- a/builtin/fast-import.c
+++ b/builtin/fast-import.c
@@ -2320,7 +2320,7 @@ static void file_change_m(const char *p, struct branch *b)
 	static struct strbuf path = STRBUF_INIT;
 	struct object_entry *oe;
 	struct object_id oid;
-	uint16_t mode, inline_data = 0;
+	uint16_t mode = mode, inline_data = 0;
 
 	p = parse_mode(p, &mode);
 	if (!p)
diff --git a/compat/linux/procinfo.c b/compat/linux/procinfo.c
index 4bb2d66227..17937906b8 100644
--- a/compat/linux/procinfo.c
+++ b/compat/linux/procinfo.c
@@ -129,7 +129,7 @@ static int stat_parent_pid(pid_t pid, struct strbuf *name, int *statppid)
 static void push_ancestry_name(struct strvec *names, pid_t pid)
 {
 	struct strbuf name = STRBUF_INIT;
-	int ppid;
+	int ppid = ppid;
 
 	if (stat_parent_pid(pid, &name, &ppid) < 0)
 		goto cleanup;
-- 
2.45.2-445-g1b76f06508





[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux