gallium/llvmpipe: Fix compiler warnings about ddx/ddy/ddmax.
authorEric Anholt <eric@anholt.net>
Sat, 10 Feb 2018 10:24:14 +0000 (10:24 +0000)
committerEric Anholt <eric@anholt.net>
Mon, 12 Feb 2018 20:48:18 +0000 (20:48 +0000)
My gcc doesn't figure out that dims >= 1 (seems reasonable), and doesn't
notice that ddmax is used from the same no_rho_opt as its initialization.

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
src/gallium/auxiliary/gallivm/lp_bld_sample.c

index db3d9d65c9caac0aa7986d624731f15008cb214e..ab9d051c91156ea4044158c3a1813767905e606a 100644 (file)
@@ -275,7 +275,7 @@ lp_build_rho(struct lp_build_sample_context *bld,
       rho = lp_build_mul(rho_bld, cubesize, rho);
    }
    else if (derivs) {
-      LLVMValueRef ddmax[3], ddx[3], ddy[3];
+      LLVMValueRef ddmax[3] = { NULL }, ddx[3] = { NULL }, ddy[3] = { NULL };
       for (i = 0; i < dims; i++) {
          LLVMValueRef floatdim;
          LLVMValueRef indexi = lp_build_const_int32(gallivm, i);