[PATCH] Fix maybe-uninitialized compiler warning
Vehrs, Josiah
jvehrs@amazon.com
Tue Apr 7 18:23:48 GMT 2026
Hi Nick,
This was compiling with gcc 16.0.1. I’ll update our patch to match that.
Thanks!
Josiah
From: Nick Clifton <nickc@redhat.com>
Date: Tuesday, April 7, 2026 at 2:13 AM
To: Vehrs, Josiah <jvehrs@amazon.com>, annobin@sourceware.org <annobin@sourceware.org>
Subject: [PATCH] Fix maybe-uninitialized compiler warning
Hi Josiah,
> Move link declaration before the first call to TRY_DEBUG which can call
> goto return_fail potentially referencing link before initialization.
Ah - good catch. Which compiler are you using ?
> diff --git a/annocheck/annocheck.c b/annocheck/annocheck.c
> index 1757759..e9f0e7c 100644
> --- a/annocheck/annocheck.c
> +++ b/annocheck/annocheck.c
> @@ -861,6 +861,7 @@ annocheck_open_separate_debuginfo_file (annocheck_data * data, char ** filename_
> int fd = -1;
> char * debugfile = NULL;
> char * build_id_name = NULL;
> + const char * link;
Even moving the declaration here, there is still a theoretical chance
that 'link' can be used uninitialised. So I have changed the above
line to:
> + const char * link = NULL;
Committed with this change. Thanks!
Cheers
Nick
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://sourceware.org/pipermail/annobin/attachments/20260407/598c3bd7/attachment.htm>
More information about the Annobin
mailing list