git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH 1/4] Fix maybe-uninitialized warning with GCC at -O3

From
Mike Hommey <mh@glandium.org>
Date
Jun 3, 2025, 23:06 UTC
Message-ID
<20250603230646.2322671-1-mh@glandium.org>
```
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
Next: Mike Hommey
Message 1 of 11 in “Fix maybe-uninitialized warning with GCC at -O3”
  1. 1/4 Fix maybe-uninitialized warning with GCC at -O3Mike Hommey, Jun 3, 2025
  2. 4/4 Fix unreachable-code warning with clang on WindowsMike Hommey, Jun 3, 2025
  3. Patrick SteinhardtJun 4, 2025
  4. Junio C HamanoJun 4, 2025
  5. 3/4 Fix comma warnings with clang on WindowsMike Hommey, Jun 3, 2025
  6. Junio C HamanoJun 3, 2025
  7. 2/4 Fix use-after-free warning with GCC at -O3Mike Hommey, Jun 3, 2025
  8. Junio C HamanoJun 3, 2025
  9. Patrick SteinhardtJun 4, 2025
  10. Patrick SteinhardtJun 4, 2025
  11. Jeff KingJun 6, 2025

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.