[Mesa-dev] [PATCH] gallium: Fix uninitialized variable warning in compute test.

Elie Tournier tournier.elie at gmail.com
Tue Nov 27 11:17:53 UTC 2018


On Mon, Nov 26, 2018 at 01:13:16PM -0800, Eric Anholt wrote:
> The compiler doesn't know that ny != 0, so x might be uninitialized for
> the printf at the end.

Reviewed-by: Elie Tournier <elie.tournier at collabora.com>
> ---
>  src/gallium/tests/trivial/compute.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/src/gallium/tests/trivial/compute.c b/src/gallium/tests/trivial/compute.c
> index afe5d3e9f2be..20e5a4f140c9 100644
> --- a/src/gallium/tests/trivial/compute.c
> +++ b/src/gallium/tests/trivial/compute.c
> @@ -240,7 +240,7 @@ static void check_tex(struct context *ctx, int slot,
>                    util_format_get_nblocksy(tex->format, tex->height0));
>          struct pipe_transfer *xfer;
>          char *map;
> -        int x, y, i;
> +        int x = 0, y, i;
>          int err = 0;
>  
>          if (!check)
> -- 
> 2.20.0.rc1
> 
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev


More information about the mesa-dev mailing list