On 03.12.2009 01:38, Jose Fonseca wrote: > Interesting. Yes we want to fix the problem, as we're missing out > potential optimizations. > > For fixing reference counting, couldn't we fix it by doing the final > > > *pdst = src; > > in each pipe_xxx_reference function in the bottom of p_state.h, and > pass only &(*pdst)->reference, &src->reference to the p_refcnt.h's > pipe_reference() instead (i.e., just pointers, and no pointer to > pointers)? I haven't tested it but it seems that that would eliminate > all casts, hence should be correct.
That is pretty much what I did (except I used a temporary pointer to pass its address to pipe_reference so I didn't have to change the pipe_reference function at all, so it still worked save the aliasing issues for other callers). Some callers use this directly, I can fix them I guess it's just a bit less convenient function, if this is the approach we'll take. Roland > > Jose > > ________________________________________ From: Roland Scheidegger > [srol...@vmware.com] Sent: Wednesday, December 02, 2009 23:19 To: > Jose Fonseca Cc: mesa3d-...@lists.sf.net Subject: Re: [Mesa3d-dev] > mesa/gallium strict aliasing bugs > > On 02.12.2009 18:33, José Fonseca wrote: >> I've seen strict aliasing assumption causing bugs in other gallium >> components. It seems endemic to our code. Unless we actively >> decidee to go and chase the strict aliasing bugs now we should add >> -fno-strict-aliasing to all our builds. > > Do we ever want to fix strict aliasing? If we do, I think the problem > with refcounting is pretty fundamental (I traced the crash to > aliasing problems there, and hacked up some bogus version which > didn't segfault for the testcase I used). At least I can't see a way > to make this really work in some nice way. Supposedly gcc supports > "__attribute__((__may_alias__))" but I had no luck with it. In > gallium (not core mesa) there's only one other offender causing a > large amount of warnings, that is util_pack_color, and I think it > won't actually cause problems. ------------------------------------------------------------------------------ Join us December 9, 2009 for the Red Hat Virtual Experience, a free event focused on virtualization and cloud computing. Attend in-depth sessions from your desk. Your couch. Anywhere. http://p.sf.net/sfu/redhat-sfdev2dev _______________________________________________ Mesa3d-dev mailing list Mesa3d-dev@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mesa3d-dev