Public bug reported: pthread_join() appears to behave differently depending on gcc optimization is on or off. Build the attached source file with gcc -O2 or gcc -O0 has shown different joining results.
E.g., with `gcc pthread_join.c -lpthread -g -O2` it passes without issue. with `gcc pthread_join.c -lpthread -g -O0`, the program fails at pthread_join() with ESRCH. The same does not happen on other distros (tested on CentOS and Fedora). Some additional info: [macbeth@tests]$cat /etc/issue Ubuntu 14.04 LTS \n \l [macbeth@tests]$gcc --version gcc (Ubuntu 4.8.2-19ubuntu1) 4.8.2 Copyright (C) 2013 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. [macbeth@tests]$dpkg -l libc6 Desired=Unknown/Install/Remove/Purge/Hold | Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend |/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad) ||/ Name Version Architecture Description +++-======================================-========================-========================-================================================================================== ii libc6:amd64 2.19-0ubuntu6 amd64 Embedded GNU C Library: Shared libraries ** Affects: glibc (Ubuntu) Importance: Undecided Status: New ** Attachment added: "test program" https://bugs.launchpad.net/bugs/1427981/+attachment/4334048/+files/pthread_join.c -- You received this bug notification because you are a member of Ubuntu Bugs, which is subscribed to Ubuntu. https://bugs.launchpad.net/bugs/1427981 Title: pthread_join failure To manage notifications about this bug go to: https://bugs.launchpad.net/ubuntu/+source/glibc/+bug/1427981/+subscriptions -- ubuntu-bugs mailing list ubuntu-bugs@lists.ubuntu.com https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs