[Mesa-dev] [PATCH 006.1/129] FIXUP! Don't reach through casts in get_variable
Rob Clark
robdclark at gmail.com
Fri Jun 1 20:34:22 UTC 2018
On Fri, Jun 1, 2018 at 3:39 PM, Jason Ekstrand <jason at jlekstrand.net> wrote:
> If something uses get_variable, it's likely that it doesn't know what to
> do with casts. If there are any casts in the chain, just return NULL.
> ---
> src/compiler/nir/nir.h | 6 +++++-
> 1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/src/compiler/nir/nir.h b/src/compiler/nir/nir.h
> index 8b826d8..28a40c7 100644
> --- a/src/compiler/nir/nir.h
> +++ b/src/compiler/nir/nir.h
> @@ -1015,8 +1015,12 @@ nir_deref_instr_parent(const nir_deref_instr *instr)
> static inline nir_variable *
> nir_deref_instr_get_variable(const nir_deref_instr *instr)
> {
> - while (instr->deref_type != nir_deref_type_var)
> + while (instr->deref_type != nir_deref_type_var) {
> + if (!instr || instr->deref_type == nir_deref_type_cast)
the "while (instr->foo ...) { if (!instr || ...)" thing looks a bit suspicious..
BR,
-R
> + return NULL;
> +
> instr = nir_deref_instr_parent(instr);
> + }
>
> return instr->var;
> }
> --
> 2.5.0.400.gff86faf
>
> _______________________________________________
> 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