OK, it seems to be that pthread_join() is not working properly when
--fstack-protector is enabled, which is true on Ubuntu but false on
CentOS.

If I pass --fno-stack-protector, the test case passes in all
optimization levels.

[macbeth@tests]$gcc pthread_join.c -lpthread -fno-stack-protector -O0
[macbeth@tests]$./a.out
Joining thread 0
thread 0 joined!
Joining thread 1
thread 1 joined!
Joining thread 2
thread 2 joined!
Joining thread 3
thread 3 joined!
Joining thread 4
thread 4 joined!
Joining thread 5
thread 5 joined!
Joining thread 6
thread 6 joined!
Joining thread 7
thread 7 joined!
Joining thread 8
thread 8 joined!
Joining thread 9
thread 9 joined!
Joining thread 10
thread 10 joined!
Joining thread 11
thread 11 joined!
Joining thread 12
thread 12 joined!
Joining thread 13
thread 13 joined!
Joining thread 14
thread 14 joined!
Joining thread 15
thread 15 joined!
Joining thread 16
thread 16 joined!
Joining thread 17
thread 17 joined!
Joining thread 18
thread 18 joined!
Joining thread 19
thread 19 joined!
join_func: 20 ran successfully

And if I pass -fstack-protector on CentOS, the case fails as well.

-- 
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
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to