------- Additional Comments From matz at suse dot de 2004-10-13 18:28 ------- Still doesn't fully work. The initial testcase now works, but aRts still segfaults. This time I need this testcase: ------------------------------------- #include <string> std::string idl_filename; extern std::string idl_filename; int main() { idl_filename = "bla"; return 0; } ------------------------------------- This has to be compiled with -pthread, then it segfaults for me. Note that the "extern" line is important, including it's place (after the definition). % g++ -g -pthread mcopidl.cc % ./a.out Segmentation fault % valgrind -q --num-callers=42 --tool=memcheck ./a.out ==7097== Invalid read of size 4 ==7097== at 0x1B94C2CB: __gnu_cxx::__pool<true>::_M_reclaim_block(char*, unsigned) (in /usr/lib/libstdc++.so.6.0.3) ==7097== by 0x1B94CD13: __gnu_cxx::__mt_alloc<char, __gnu_cxx::__common_pool_policy<true> >::deallocate(char*, unsigned) (in /usr/lib/libstdc++.so.6.0.3) ==7097== by 0x1B9945A2: std::string::_Rep::_M_destroy(std::allocator<char> const&) (in /usr/lib/libstdc++.so.6.0.3) ==7097== by 0x1B995A1C: std::string::~string() (in /usr/lib/libstdc++.so.6.0.3) ==7097== by 0x804866A: __tcf_1 (mcopidl.cc:3) ==7097== by 0x1BA697EF: exit (in /lib/tls/libc.so.6) ==7097== by 0x1BA54AE9: __libc_start_main (in /lib/tls/libc.so.6) ==7097== by 0x8048580: ??? (start.S:119) ==7097== Address 0x8AA04420 is not stack'd, malloc'd or (recently) free'd Segmentation fault Note that it works either without the "extern" line or that one before the definition, or when compiling without -pthread (but KDE is compiled with that). It seems I can't reopen this bug report, so if someone else could ...
-- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17937