https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71684
--- Comment #3 from Jonathan Wakely <redi at gcc dot gnu.org> --- (In reply to nsz from comment #1) > on a posix platform pthread_mutex_destroy should be called for a mutex if > its life time ends, so the ifdef logic seems wrong (the initializer does not > make a difference). I don't think that's clear from the POSIX spec. In previous versions PTHREAD_MUTEX_INITIALIZER was only specified to be valid for statically allocated objects, which live for the lifetime of the program and so there's typically no need (or sensible time) to destroy them. http://austingroupbugs.net/view.php?id=70#c127 changed the rules so now you can use the initializer for automatic objects, and structure members, but it's unclear whether you do need to use pthread_mutex_destroy on them. Maybe POSIX should clarify. On some older versions of FreeBSD using PTHREAD_MUTEX_INITIALIZER and then pthread_mutex_destroy would segfault, see http://lists.freebsd.org/pipermail/freebsd-threads/2010-September/004905.html So it's not clear to me that using that combination is a good idea.