On Wed, Jun 25, 2008 at 11:07:24PM -0700, Morten Larsen wrote: > As far as I can tell the branch optimization fixes in 2.6.21 introduced > a bug in atomic_sub_if_positive that causes it to return even when the > sc instruction fails. The result is that e.g. down_trylock becomes > unreliable as the semaphore counter is not always decremented. I did play with a test program and can't reproduce the effect with my assembler. I have darm memories of gas immitating some obscure behaviour of the IRIX assembler and I think it doesn't do so for all MIPS targets. So I'm wandering what toolchain have you been using? Ralf