In this snippet from a semaphore post routine, sem->count is -1 before execution and 0 after, but the wrong branch is taken about once a week if it feels like it.
++sem->count; lw v0, 20(s3) ; s3 contains a pointer to the semaphore struct, offset 20 is the count within the semaphore addiu v0, v0, 1 ; Increment count sw v0, 20(s3) ; Write count out to semaphore structureif ((savedSemCount = sem->count)