From 0fa654ca925a8661dbe6acc25d3edd9a87a18860 Mon Sep 17 00:00:00 2001 From: Willy Tarreau Date: Thu, 10 Oct 2024 06:59:12 +0200 Subject: [PATCH] BUILD: cache: silence an uninitialized warning at -Og with gcc-12.2 Building with gcc-12.2 -Og yields this incorrect warning in cache.c: In function 'release_entry_unlocked', inlined from 'http_action_store_cache' at src/cache.c:1449:4: src/cache.c:330:9: warning: 'object' may be used uninitialized [-Wmaybe-uninitialized] 330 | release_entry(cache, entry, 1); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ src/cache.c: In function 'http_action_store_cache': src/cache.c:1200:29: note: 'object' was declared here 1200 | struct cache_entry *object, *old; | ^~~~~~ This is wrong, the only way to reach the function is with first!=NULL and the gotos that reach there are all those made with first==NULL. Let's just preset object to NULL to silence it. --- src/cache.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cache.c b/src/cache.c index b291aff4c..d2cf401d6 100644 --- a/src/cache.c +++ b/src/cache.c @@ -1197,7 +1197,7 @@ enum act_return http_action_store_cache(struct act_rule *rule, struct proxy *px, struct cache *cache = cconf->c.cache; struct shared_context *shctx = shctx_ptr(cache); struct cache_st *cache_ctx = NULL; - struct cache_entry *object, *old; + struct cache_entry *object = NULL, *old; unsigned int key = read_u32(txn->cache_hash); struct htx *htx; struct http_hdr_ctx ctx;