git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/4] Fix maybe-uninitialized warning with GCC at -O3
@ 2025-06-03 23:06 Mike Hommey
  2025-06-03 23:06 ` [PATCH 2/4] Fix use-after-free " Mike Hommey
                   ` (3 more replies)
  0 siblings, 4 replies; 11+ messages in thread
From: Mike Hommey @ 2025-06-03 23:06 UTC (permalink / raw)
  To: git; +Cc: gitster, Mike Hommey

```
In file included from parse-options.c:1:
git-compat-util.h: In function ‘get_value’:
git-compat-util.h:489:21: error: ‘arg’ may be used uninitialized [-Werror=maybe-uninitialized]
  489 | #define error(...) (error(__VA_ARGS__), const_error())
      |                     ^~~~~
parse-options.c:76:21: note: ‘arg’ was declared here
   76 |         const char *arg;
      |                     ^~~
```

Signed-off-by: Mike Hommey <mh@glandium.org>
---
 parse-options.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/parse-options.c b/parse-options.c
index a9a39ecaef..cf79805bc0 100644
--- a/parse-options.c
+++ b/parse-options.c
@@ -73,7 +73,7 @@ static enum parse_opt_result do_get_value(struct parse_opt_ctx_t *p,
 					  enum opt_parsed flags,
 					  const char **argp)
 {
-	const char *arg;
+	const char *arg = NULL;
 	const int unset = flags & OPT_UNSET;
 	int err;
 
-- 
2.50.0.rc1.593.g042f21cb9b


^ permalink raw reply related	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2025-06-06  0:23 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-06-03 23:06 [PATCH 1/4] Fix maybe-uninitialized warning with GCC at -O3 Mike Hommey
2025-06-03 23:06 ` [PATCH 2/4] Fix use-after-free " Mike Hommey
2025-06-03 23:47   ` Junio C Hamano
2025-06-04  7:36   ` Patrick Steinhardt
2025-06-03 23:06 ` [PATCH 3/4] Fix comma warnings with clang on Windows Mike Hommey
2025-06-03 23:51   ` Junio C Hamano
2025-06-03 23:06 ` [PATCH 4/4] Fix unreachable-code warning " Mike Hommey
2025-06-04  7:36   ` Patrick Steinhardt
2025-06-04 15:50     ` Junio C Hamano
2025-06-04  7:36 ` [PATCH 1/4] Fix maybe-uninitialized warning with GCC at -O3 Patrick Steinhardt
2025-06-06  0:23   ` Jeff King

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).