On 12.06.2014 17:00, Maarten Lankhorst wrote: > I'm pretty sure that p_atomic_dec_zero should return 1 if the count > drops to zero. > > Cc: "10.2 10.1 10.0" <mesa-sta...@lists.freedesktop.org>
I don't think the stable tag is justified: These bugs have been there for more than four years. Nothing in Gallium can work properly if the return value of p_atomic_dec_zero() is inverted, so if there was significant use of the broken variants, we should have heard about it long ago. > Signed-off-by: Maarten Lankhorst <maarten.lankho...@canonical.com> > --- > diff --git a/src/gallium/auxiliary/util/u_atomic.h > b/src/gallium/auxiliary/util/u_atomic.h > index 2f2b42b..08cadb4 100644 > --- a/src/gallium/auxiliary/util/u_atomic.h > +++ b/src/gallium/auxiliary/util/u_atomic.h > @@ -183,7 +183,7 @@ p_atomic_cmpxchg(int32_t *v, int32_t old, int32_t _new) > > #define p_atomic_set(_v, _i) (*(_v) = (_i)) > #define p_atomic_read(_v) (*(_v)) > -#define p_atomic_dec_zero(_v) ((boolean) --(*(_v))) > +#define p_atomic_dec_zero(_v) (!(boolean) --(*(_v))) Will this compile (with the intended result) without another set of parens? > @@ -324,7 +324,7 @@ p_atomic_dec_zero(int32_t *v) > { > uint32_t n = atomic_dec_32_nv((uint32_t *) v); > > - return n != 0; > + return n == 0; > } This looks good, but there are more variants which look similarly broken? -- Earthling Michel Dänzer | http://www.amd.com Libre software enthusiast | Mesa and X developer _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev