Mesa (main): gallivm: Fix a few uninitialized variable warnings.
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Thu May 20 17:43:17 UTC 2021
Module: Mesa
Branch: main
Commit: b778564c76662abe0937ec71faaba38e46ec9a0a
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=b778564c76662abe0937ec71faaba38e46ec9a0a
Author: Timur Kristóf <timur.kristof at gmail.com>
Date: Fri May 14 17:03:36 2021 +0200
gallivm: Fix a few uninitialized variable warnings.
Signed-off-by: Timur Kristóf <timur.kristof at gmail.com>
Reviewed-by: Adam Jackson <ajax at redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10806>
---
src/gallium/auxiliary/gallivm/lp_bld_format_s3tc.c | 3 +++
src/gallium/auxiliary/gallivm/lp_bld_nir.c | 2 ++
2 files changed, 5 insertions(+)
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_format_s3tc.c b/src/gallium/auxiliary/gallivm/lp_bld_format_s3tc.c
index e17c7881e7d..497d403fad3 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_format_s3tc.c
+++ b/src/gallium/auxiliary/gallivm/lp_bld_format_s3tc.c
@@ -2365,6 +2365,9 @@ lp_build_gather_rgtc(struct gallivm_state *gallivm,
lp_build_const_int32(gallivm, 2), "");
*green_hi = LLVMBuildExtractElement(builder, elem,
lp_build_const_int32(gallivm, 3), "");
+ } else {
+ *green_lo = NULL;
+ *green_hi = NULL;
}
} else {
LLVMValueRef tmp[4];
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_nir.c b/src/gallium/auxiliary/gallivm/lp_bld_nir.c
index 51c6ecbd615..5d2c27ec29a 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_nir.c
+++ b/src/gallium/auxiliary/gallivm/lp_bld_nir.c
@@ -1053,6 +1053,7 @@ static void visit_load_const(struct lp_build_nir_context *bld_base,
struct lp_build_context *int_bld = get_int_bld(bld_base, true, instr->def.bit_size);
for (unsigned i = 0; i < instr->def.num_components; i++)
result[i] = lp_build_const_int_vec(bld_base->base.gallivm, int_bld->type, instr->def.bit_size == 32 ? instr->value[i].u32 : instr->value[i].u64);
+ memset(&result[instr->def.num_components], 0, NIR_MAX_VEC_COMPONENTS - instr->def.num_components);
assign_ssa_dest(bld_base, &instr->def, result);
}
@@ -2120,6 +2121,7 @@ static void visit_ssa_undef(struct lp_build_nir_context *bld_base,
struct lp_build_context *undef_bld = get_int_bld(bld_base, true, instr->def.bit_size);
for (unsigned i = 0; i < num_components; i++)
undef[i] = LLVMGetUndef(undef_bld->vec_type);
+ memset(&undef[num_components], 0, NIR_MAX_VEC_COMPONENTS - num_components);
assign_ssa_dest(bld_base, &instr->def, undef);
}
More information about the mesa-commit
mailing list