draw: fix uninit variable false positive

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: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25884>
This commit is contained in:
Mike Blumenkrantz 2023-10-24 09:16:25 -04:00 committed by Marge Bot
parent 0a564171f6
commit d446ccfc81

View file

@ -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);