https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63564
--- Comment #3 from Bernd Edlinger <bernd.edlinger at hotmail dot de> --- In the original example (it was ported from windows, and the windows semaphores are completely immune against this kind of error) the sem_post were in *another* thread and there were several milliseconds between the free the next malloc. So this is already a really, really hard to find bug. But what I don't understand, why the malloc does *not* crash when address sanitizer is used. The same for thread sanitizer, it does not spot the error, and the error does not happen in debug builds only in release builds.