https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99572
Jonathan Wakely <redi at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|ASSIGNED |RESOLVED Resolution|--- |DUPLICATE Target Milestone|15.0 |11.2 --- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> --- This was fixed by r12-1732-ge02840c1a92abe for Bug 100806 I think the fix is correct and the FIXME in the code should be removed. It's necessary to wake all waiters, because otherwise we can have the following sequence: Thread A Thread B Thread C acquire() acquire() release(1): increment counter to 1 wake one thread-----\ \ \ release(1) \ increment counter to 2 \ \ \-----> decrement counter to 1 Here it should be possible for C to wake up and acquire the semaphore, but because we only woke one thread it remains blocked. If we wake all threads then B and C can both wake up and acquire the semaphore. *** This bug has been marked as a duplicate of bug 100806 ***