I tried to figure out what is going on here, but it's getting to complicated in the libstdc++ innards for me to spot the problem. In any case, this little program ------------------- #include <vector> #include <algorithm>
struct S { unsigned int line; std::vector<double> entries; bool operator < (const S &a) const { return line < a.line; } }; int main () { std::vector<S> lines(20000); std::sort (lines.begin(), lines.end()); } ------------------------ produces a segfault for me when compiled with parallel mode. A backtrace is here: (gdb) bt #0 0x0805cf59 in ~vector (this=0xb6439ffc) at /tmp/bangerth/bin/gcc-mainline/lib/gcc/i686-pc-linux-gnu/4.3.0/../../../../include/c++/4.3.0/bits/stl_vector.h:304 #1 0x0805cf9d in ~S (this=0xb6439ff8) at step-14.cc:5 #2 0x0806d1b9 in __gnu_parallel::parallel_sort_mwms_pu<__gnu_cxx::__normal_iterator<S*, std::__cxx1998::vector<S, std::allocator<S> > >, std::less<S> > ( d=0x807722c, [EMAIL PROTECTED]) at /tmp/bangerth/bin/gcc-mainline/lib/gcc/i686-pc-linux-gnu/4.3.0/../../../../include/c++/4.3.0/parallel/multiway_mergesort.h:312 #3 0x08057c73 in __gnu_parallel::parallel_sort_mwms<__gnu_cxx::__normal_iterator<S*, std::__cxx1998::vector<S, std::allocator<S> > >, std::less<S> > ( .omp_data_i=0xbfffd450) at /tmp/bangerth/bin/gcc-mainline/lib/gcc/i686-pc-linux-gnu/4.3.0/../../../../include/c++/4.3.0/parallel/multiway_mergesort.h:391 #4 0xb6dd03e0 in gomp_thread_start (xdata=0xbfffd330) at ../../../svn/libgomp/team.c:108 #5 0xb6db2aa7 in start_thread () from /lib/tls/libpthread.so.0 This is in the worker thread, not the main thread from which it was spawned. Hope this helps, cheers W. -- Summary: parallel mode: segfault in std::sort Product: gcc Version: 4.3.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: libstdc++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: bangerth at dealii dot org http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34095