From 369a350e04911b5941d4261646a13cfe41c7be52 Mon Sep 17 00:00:00 2001 From: Aram Sargsyan Date: Mon, 25 Aug 2025 10:06:50 +0000 Subject: [PATCH] Resolve false positive compilation warning from some GCC versions The complier claims that 'qresult_type' may be used uninitialized, though all the cases inside the switch either set the variable or return from the function, and the warning is generated on a line after the switch-case block. Slightly modify the code to set a default value for the variable when declaring it. In function 'rpz_rewrite', inlined from 'query_checkrpz' at query.c:7288:12, inlined from 'query_gotanswer' at query.c:7724:12: query.c:4693:14: error: 'qresult_type' may be used uninitialized [-Werror=maybe-uninitialized] 4693 | !dnsrps_set_p(&emsg, client, st, qtype, &rdataset, | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 4694 | qresult_type != qresult_type_recurse)) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ query.c: In function 'query_gotanswer': query.c:4268:24: note: 'qresult_type' was declared here 4268 | qresult_type_t qresult_type; | ^~~~~~~~~~~~ cc1: all warnings being treated as errors --- lib/ns/query.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/ns/query.c b/lib/ns/query.c index e9e9ae2dc3..d43f94c124 100644 --- a/lib/ns/query.c +++ b/lib/ns/query.c @@ -4265,7 +4265,7 @@ rpz_rewrite(ns_client_t *client, dns_rdatatype_t qtype, isc_result_t qresult, dns_rdataset_t *rdataset = NULL; dns_fixedname_t nsnamef; dns_name_t *nsname; - qresult_type_t qresult_type; + qresult_type_t qresult_type = qresult_type_done; dns_rpz_zbits_t zbits; isc_result_t result = ISC_R_SUCCESS; dns_rpz_have_t have;