[libdispatch-dev] lib dispatch worker threads may loop depending on compiler optimization

Paolo Bonzini bonzini at gnu.org
Tue Sep 13 23:47:53 PDT 2011

On Tue, Sep 13, 2011 at 20:48, Jordan K. Hubbard <jkh at apple.com> wrote:
> > I can see that it is not obvious
> > whether the FSF even views this as a bug (Paolo started the discussion
> > at http://gcc.gnu.org/ml/gcc/2011-09/msg00088.html which is still ongoing…)

I think the patch diverted a bit from that.

By the way, it would be nice if you could attach a preprocessed
testcase (obtained with --save-temps) to the trac ticket, and/or
create a GCC bugzilla entry with it.

> A fair point, though I'm still not sure how big the "community" of
> gcc-4.5.1+libdispatch users truly is.  If there are only, say, 4 of you then
> you can at just pass the patch around at your next user group meeting. ;)
> That said (and thanks for the pointer to the discussion thread on the gcc
> lists), I'm seeing more folks in the gcc discussion arguing for treating
> this as an optimization barrier than not, so maybe the gcc folks WILL make
> the change and the worst that will happen is you have to wait for gcc-4.5.3
> or something.   Perhaps we should give the discussion another week or so to
> play out and then see where things are?

I think the patch should be applied anyway, since anyway
__sync_lock_test_and_set is meant to be an acquire barrier only.
While we know that on x86 it will be a full *processor* barrier, we
cannot know what the compiler will do.


More information about the libdispatch-dev mailing list