[Mesa-dev] [PATCH] nir: Fix uninitialized use of 'replacement'.
Anuj Phogat
anuj.phogat at gmail.com
Tue Jul 19 19:33:08 UTC 2016
On Tue, Jul 19, 2016 at 12:25 PM, Kenneth Graunke <kenneth at whitecape.org> wrote:
> For intrinsics we don't care about, just skip to the next loop iteration
> and process the next instruction. We don't want to execute the rest of
> the code.
>
> This was a bug in commit cdfc05ea6e8c87876cdbf588aa8e03d70f3da4bb.
>
> Signed-off-by: Kenneth Graunke <kenneth at whitecape.org>
> ---
> 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 71d2432..189370d 100644
> --- a/src/compiler/nir/nir_lower_io.c
> +++ b/src/compiler/nir/nir_lower_io.c
> @@ -352,41 +352,41 @@ nir_lower_io_block(nir_block *block,
>
> case nir_intrinsic_store_var:
> replacement = lower_store(intrin, state, vertex_index, offset);
> break;
>
> case nir_intrinsic_var_atomic_add:
> case nir_intrinsic_var_atomic_imin:
> case nir_intrinsic_var_atomic_umin:
> case nir_intrinsic_var_atomic_imax:
> case nir_intrinsic_var_atomic_umax:
> case nir_intrinsic_var_atomic_and:
> case nir_intrinsic_var_atomic_or:
> case nir_intrinsic_var_atomic_xor:
> case nir_intrinsic_var_atomic_exchange:
> case nir_intrinsic_var_atomic_comp_swap:
> assert(vertex_index == NULL);
> replacement = lower_atomic(intrin, state, offset);
> break;
>
> default:
> - break;
> + continue;
> }
>
> if (nir_intrinsic_infos[intrin->intrinsic].has_dest) {
> if (intrin->dest.is_ssa) {
> nir_ssa_dest_init(&replacement->instr, &replacement->dest,
> intrin->dest.ssa.num_components,
> intrin->dest.ssa.bit_size, NULL);
> nir_ssa_def_rewrite_uses(&intrin->dest.ssa,
> nir_src_for_ssa(&replacement->dest.ssa));
> } else {
> nir_dest_copy(&replacement->dest, &intrin->dest, state->mem_ctx);
> }
> }
>
> nir_instr_insert_before(&intrin->instr, &replacement->instr);
> nir_instr_remove(&intrin->instr);
> }
>
> return true;
> }
> --
> 2.9.0
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Reviewed-by: Anuj Phogat <anuj.phogat at gmail.com>
More information about the mesa-dev
mailing list