Package: libc6-dev Version: 2.24-11+deb9u1 Severity: important A minimal program that exercises R/W locks crashes when linked statically:
$ cat test-rwlock.c #include <pthread.h> int main() { pthread_rwlock_t rw; if (pthread_rwlock_init(&rw, NULL)) return -1; if (pthread_rwlock_wrlock(&rw)) return -2; if (pthread_rwlock_unlock(&rw)) return -3; if (pthread_rwlock_destroy(&rw)) return -4; return 0; } $ cc -pthread -O0 -g test-rwlock.c ; ./a.out ; echo $? 0 $ cc -pthread -static -O0 -g test-rwlock.c ; ./a.out ; echo $? Illegal instruction 132 Most likely, the problem is not in pthread_rwlock_unlock, but in pthread_rwlock_wrlock: gdb shows that when the latter returns, rw.__data.__writer == pid_of_the_process in the dynamic case, and rw.__data.__writer == 0 in the static case. Best regards, g. -- System Information: Debian Release: 9.1 APT prefers stable-debug APT policy: (500, 'stable-debug'), (500, 'stable') Architecture: amd64 (x86_64) Kernel: Linux 4.9.0-4-amd64 (SMP w/2 CPU cores) Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8), LANGUAGE=en_US.UTF-8 (charmap=UTF-8) Shell: /bin/sh linked to /bin/dash Init: sysvinit (via /sbin/init) Versions of packages libc6-dev:amd64 depends on: ii libc-dev-bin 2.24-11+deb9u1 ii libc6 2.24-11+deb9u1 ii linux-libc-dev 4.9.51-1 libc6-dev:amd64 recommends no packages. Versions of packages libc6-dev:amd64 suggests: ii glibc-doc 2.24-11+deb9u1 ii manpages-dev 4.10-2 -- no debconf information