From d446ccfc81bc985e592949bc440fbd6709ecf737 Mon Sep 17 00:00:00 2001 From: Mike Blumenkrantz Date: Tue, 24 Oct 2023 09:16:25 -0400 Subject: [PATCH] draw: fix uninit variable false positive MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit In function ‘generate_clipmask’, inlined from ‘draw_llvm_generate’ at ../src/gallium/auxiliary/draw/draw_llvm.c:1975:24: ../src/gallium/auxiliary/draw/draw_llvm.c:1302:25: warning: ‘sum’ may be used uninitialized [-Wmaybe-uninitialized] 1302 | sum = lp_build_fmuladd(builder, planes, | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 1303 | (LLVMValueRef[]){cv_x, cv_y, cv_z, cv_w}[i], sum); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ../src/gallium/auxiliary/draw/draw_llvm.c: In function ‘draw_llvm_generate’: ../src/gallium/auxiliary/draw/draw_llvm.c:1149:44: note: ‘sum’ was declared here 1149 | LLVMValueRef plane1, planes, plane_ptr, sum; | ^~~ Part-of: --- src/gallium/auxiliary/draw/draw_llvm.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/gallium/auxiliary/draw/draw_llvm.c b/src/gallium/auxiliary/draw/draw_llvm.c index 3516fce6325..f4e0d70cd32 100644 --- a/src/gallium/auxiliary/draw/draw_llvm.c +++ b/src/gallium/auxiliary/draw/draw_llvm.c @@ -1146,7 +1146,7 @@ generate_clipmask(struct draw_llvm *llvm, LLVMValueRef zero, shift; LLVMValueRef pos_x, pos_y, pos_z, pos_w; LLVMValueRef cv_x, cv_y, cv_z, cv_w; - LLVMValueRef plane1, planes, plane_ptr, sum; + LLVMValueRef plane1, planes, plane_ptr; struct lp_type f32_type = vs_type; struct lp_type i32_type = lp_int_type(vs_type); const unsigned pos = llvm->draw->vs.position_output; @@ -1287,6 +1287,7 @@ generate_clipmask(struct draw_llvm *llvm, } else { LLVMTypeRef vs_elem_type = lp_build_elem_type(gallivm, vs_type); LLVMTypeRef vs_type_llvm = lp_build_vec_type(gallivm, vs_type); + LLVMValueRef sum = NULL; indices[0] = lp_build_const_int32(gallivm, 0); indices[1] = lp_build_const_int32(gallivm, plane_idx);