[Mesa-dev] [PATCH 03/17] gallium/llvmpipe: Fix compiler warnings about ddx/ddy/ddmax.

Roland Scheidegger sroland at vmware.com
Mon Feb 12 13:17:01 UTC 2018


I'm wondering if it would help if no_rho_opt were const.
But I suppose the problem there really is that the for loop and the if
condition have swapped order the second time.

Reviewed-by: Roland Scheidegger <sroland at vmware.com>
Am 10.02.2018 um 17:32 schrieb Eric Anholt:
> 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.
> 
> Cc: Roland Scheidegger <sroland at vmware.com>
> ---
>  src/gallium/auxiliary/gallivm/lp_bld_sample.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/src/gallium/auxiliary/gallivm/lp_bld_sample.c b/src/gallium/auxiliary/gallivm/lp_bld_sample.c
> index db3d9d65c9ca..ab9d051c9115 100644
> --- a/src/gallium/auxiliary/gallivm/lp_bld_sample.c
> +++ b/src/gallium/auxiliary/gallivm/lp_bld_sample.c
> @@ -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);
> 



More information about the mesa-dev mailing list