Opened 9 years ago

Last modified 8 years ago

#9118 reopened Bugs

Seg fault on thread join — at Version 3

Reported by: tconant@… Owned by: viboes
Milestone: To Be Determined Component: thread
Version: Boost 1.54.0 Severity: Problem
Keywords: Cc:

Description (last modified by viboes)

This issue appears to be specific to llvm libc++ standard library

the program compiled with the following options will have a seg fault on thread join.

clang -x c++ -arch x86_64 -std=gnu++11 -stdlib=libc++ -I/opt/local/include -c main.cpp -o main.o
clang++ -arch x86_64  -L/opt/local/lib  main.o -stdlib=libc++ -lboost_system-mt -lboost_thread-mt -o mutex_test

the program compiled with

clang -x c++ -arch x86_64 -I/opt/local/include -c main.cpp -o main.o
clang++ -arch x86_64  -L/opt/local/lib  main.o -lboost_system-mt -lboost_thread-mt -o mutex_test
System Version :  OS X Mountain Lion 10.8.4
Compiler :
$ clang --version
Apple LLVM version 4.2 (clang-425.0.28) (based on LLVM 3.2svn)
Target: x86_64-apple-darwin12.4.0
Thread model: posix
Boost: built/installed with mac ports

Change History (4)

by gosuperninja@…, 9 years ago

Attachment: main.cpp added

comment:1 by anonymous, 9 years ago

The description got messed up when I copied and pasted it in

The following generates an executable that will seg fault.

clang -x c++ -arch x86_64 -std=gnu++11 -stdlib=libc++ -I/opt/local/include -c main.cpp -o main.o
clang++ -arch x86_64 -L/opt/local/lib main.o -stdlib=libc++ -lboost_system-mt -lboost_thread-mt -o mutex_test

The following will generate an executable that will not seg fault

clang -x c++ -arch x86_64 -I/opt/local/include -std=gnu++11 -c main.cpp -o main.o
clang++ -arch x86_64  -L/opt/local/lib  main.o -lboost_system-mt -lboost_thread-mt -o mutex_test

comment:2 by anonymous, 9 years ago

Here is a the backtrace :

Program received signal EXC_BAD_ACCESS, Could not access memory.
Reason: KERN_INVALID_ADDRESS at address: 0x0000000000000001
0x000000010002df45 in boost::detail::thread_data_base::~thread_data_base ()
(gdb) bt
#0  0x000000010002df45 in boost::detail::thread_data_base::~thread_data_base ()
#1  0x0000000100004c15 in boost::detail::thread_data<boost::_bi::bind_t<void, void (*)(), boost::_bi::list0> >::~thread_data ()
#2  0x0000000100003b05 in boost::detail::thread_data<boost::_bi::bind_t<void, void (*)(), boost::_bi::list0> >::~thread_data ()
#3  0x0000000100003b29 in boost::detail::thread_data<boost::_bi::bind_t<void, void (*)(), boost::_bi::list0> >::~thread_data ()
#4  0x0000000100005aee in boost::checked_delete<boost::detail::thread_data<boost::_bi::bind_t<void, void (*)(), boost::_bi::list0> > > ()
#5  0x0000000100005be9 in boost::detail::sp_counted_impl_p<boost::detail::thread_data<boost::_bi::bind_t<void, void (*)(), boost::_bi::list0> > >::dispose ()
#6  0x000000010002e9bf in boost::thread::join_noexcept ()
#7  0x00000001000019a4 in boost::thread::join ()
#8  0x0000000100000d45 in main ()
(gdb) 

comment:3 by viboes, 9 years ago

Description: modified (diff)
Owner: changed from Anthony Williams to viboes
Status: newassigned
Note: See TracTickets for help on using tickets.