This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug libstdc++/15026] New: Sporadic crash when application exits on Solaris 5.9


In testing http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15015 
with gcc 3.3.3 on Solaris 5.9, I got a different crash, maybe every 1 out of 10 runs. 
I reproduce the test application here: 
  
/*****************************************************  
 Test code to exercise iostreams under threads  
  
Compile with:  
   g++ -Wall -O2 thread-iostream.cxx -lpthread  
Execute:  
   ./a.out  
******************************************************/  
#include <pthread.h>  
#include <iostream>  
#include <sstream>  
  
const int num_threads = 200;  
  
void *runner(void * param);   /* function that the thread will execute */  
  
int main (int argc, const char **argv)  
{  
  pthread_t tid[num_threads];  
  
 for (int i = 0; i < num_threads; i ++)  
   pthread_create( &tid[i], NULL, runner, NULL);  
  
 for (int i = 0; i < num_threads; i ++)  
   pthread_join( tid[i], NULL);  // makes the main code wait for the thread   
  
 std::cout << "Exiting ok.\n";  
 return 0;  
}  
  
void * runner(void *param)  
{  
  std::stringstream fmt;  
    
  for (int i = 0; i < 10; i++)  
    fmt << "today" << 3.14157 << "is bogus\n";  
  
  pthread_exit(0);  
  return 0;  
}  
// EOF for thread-iostream.cxx  
  
It crashes sporadically at exit, always with the  
backtrace:  
  
(gdb) bt  
#0  0xff2b5900 in __deregister_frame_info_bases (begin=0xff361e04)  
    at ../../gcc-3.3.3/gcc/unwind-dw2-fde.c:183  
#1  0xff32676c in __do_global_dtors_aux ()  
   from /usr/gnu/gcc33/lib/gcc-lib/sparc-sun-solaris2.9/3.3.3/libstdc++.so.5  
#2  0xff35d0b4 in _fini ()  
   from /usr/gnu/gcc33/lib/gcc-lib/sparc-sun-solaris2.9/3.3.3/libstdc++.so.5  
  
$ /usr/gnu/gcc33/bin/g++ -v  
Reading specs from /usr/gnu/gcc33/lib/gcc-lib/sparc-sun-solaris2.9/3.3.3/specs  
Configured with: ../gcc-3.3.3/configure --prefix=/usr/gnu/gcc33 --with-gnu-as  
--with-cpu=supersparc --with-gnu-ld --with-ld=/usr/gnu/bin/ld --with-as=/usr/gnu/bin/as  
--enable-version-specific-runtime-libs --enable-long-long --enable-threads  
--enable-languages=c,c++  
Thread model: posix  
gcc version 3.3.3

-- 
           Summary: Sporadic crash when application exits on Solaris 5.9
           Product: gcc
           Version: 3.3.3
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: libstdc++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: harri dot pasanen at trema dot com
                CC: gcc-bugs at gcc dot gnu dot org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15026


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]