Hello there
I'm getting a SIGSEGV when using the boost::shared_ptr in my program and
compiling with the g++ -O2 option, whereas if I'm using the g++ -O0 option
my programs works the way it should. My program is multi-threaded but to the
best of my knowledge it is mutex'ed correctly.
I compile my program the following way when using -O2 and -O0
g++ -O0 -ggdb3 -DNDEBUG -DTTSERVER ....
g++ -O2 -ggdb3 -DNDEBUG -DTTSERVER ....
When I use gdb to step through the program (only with 'n') I go into the
shared_count.hpp file when using the -O2 option whereas the version compiled
with -O0 disregards this file in gdb.
The -O2 version of the program crashes in the file checked_delete.hpp and
the member "checked_delete":
template<class T> inline void checked_delete(T * x)
{
// intentionally complex - simplification causes regressions
typedef char type_must_be_complete[ sizeof(T)? 1: -1 ];
(void) sizeof(type_must_be_complete);
=> delete x;
}
Here's the gdb output:
Program received signal SIGSEGV, Segmentation fault.
0x08053370 in
boost::detail::sp_counted_base_impl