[Mesa-dev] [PATCH 09/17] spirv: Silence compiler warning about undefined srcs[0]

Eric Anholt eric at anholt.net
Sat Feb 10 16:33:02 UTC 2018


It doesn't know that elems >= 1.

Cc: Jason Ekstrand <jason.ekstrand at intel.com>
---
 src/compiler/spirv/spirv_to_nir.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/compiler/spirv/spirv_to_nir.c b/src/compiler/spirv/spirv_to_nir.c
index c6df764682ec..f86d45511df8 100644
--- a/src/compiler/spirv/spirv_to_nir.c
+++ b/src/compiler/spirv/spirv_to_nir.c
@@ -2923,7 +2923,7 @@ vtn_handle_composite(struct vtn_builder *b, SpvOp opcode,
    case SpvOpCompositeConstruct: {
       unsigned elems = count - 3;
       if (glsl_type_is_vector_or_scalar(type)) {
-         nir_ssa_def *srcs[4];
+         nir_ssa_def *srcs[4] = { NULL };
          for (unsigned i = 0; i < elems; i++)
             srcs[i] = vtn_ssa_value(b, w[3 + i])->def;
          val->ssa->def =
-- 
2.15.0



More information about the mesa-dev mailing list