This is dependant on bug 32261. g++ -g -O3 gccbug.cpp -pthread -o gccbug -s
#include <pthread.h> #include <string> void* thread_function(void*) { for (int k = 0; k < 50000; k++) { std::string my_str; my_str += "foo"; } return 0; } int main() { pthread_t thread1, thread2; pthread_create(&thread1, NULL, thread_function, NULL); pthread_create(&thread2, NULL, thread_function, NULL); void* exitcode; pthread_join(thread1, &exitcode); pthread_join(thread2, &exitcode); return 0; } -- Summary: Ad test case for Thread race segfault in std::string::append with -O and -s Product: gcc Version: unknown Status: UNCONFIRMED Severity: enhancement Priority: P3 Component: testsuite AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: appfault at hotmail dot com http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33394