[Mesa-dev] [PATCH 006.1/129] FIXUP! Don't reach through casts in get_variable

Jason Ekstrand jason at jlekstrand.net
Fri Jun 1 22:02:23 UTC 2018


On Fri, Jun 1, 2018 at 1:34 PM, Rob Clark <robdclark at gmail.com> wrote:

> 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..
>

You're right, that is fishy.  Let me try again.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20180601/adb6c3c3/attachment-0001.html>


More information about the mesa-dev mailing list