[Mesa-dev] [PATCH v2] nir: fix warning in nir_lower_io.c

Jason Ekstrand jason at jlekstrand.net
Tue Jan 8 19:48:56 UTC 2019


ACK

On Tue, Jan 8, 2019 at 12:27 PM Caio Marcelo de Oliveira Filho <
caio.oliveira at intel.com> wrote:

> Initialize the variable with NULL.  Fixes the following
>
>     In file included from ../src/compiler/nir/nir_lower_io.c:34:
>     ../src/compiler/nir/nir_lower_io.c: In function
> ‘nir_lower_explicit_io’:
>     ../src/compiler/nir/nir.h:668:11: warning: ‘addr’ may be used
> uninitialized in this function [-Wmaybe-uninitialized]
>         return src;
>                ^~~
>     ../src/compiler/nir/nir_lower_io.c:735:17: note: ‘addr’ was declared
> here
>         nir_ssa_def *addr;
>                      ^~~~
>
> v2: Avoid using a 'default' case so we get help from the compiler when
>     new deref types are added. (Lionel)
> ---
>  src/compiler/nir/nir_lower_io.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/src/compiler/nir/nir_lower_io.c
> b/src/compiler/nir/nir_lower_io.c
> index bcbfebdfa3b..44af76de599 100644
> --- a/src/compiler/nir/nir_lower_io.c
> +++ b/src/compiler/nir/nir_lower_io.c
> @@ -732,7 +732,7 @@ lower_explicit_io_deref(nir_builder *b,
> nir_deref_instr *deref,
>     assert(deref->parent.is_ssa);
>     nir_ssa_def *parent_addr = deref->parent.ssa;
>
> -   nir_ssa_def *addr;
> +   nir_ssa_def *addr = NULL;
>     assert(deref->dest.is_ssa);
>     switch (deref->deref_type) {
>     case nir_deref_type_var:
> --
> 2.20.0
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20190108/399f0241/attachment.html>


More information about the mesa-dev mailing list