This is the mail archive of the libstdc++@sourceware.cygnus.com mailing list for the libstdc++ project.


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

Re: (2.9.8) Segfault during global constructor for std_istream at program start.



hi -

Yeah, i think i've seen that.
Below is a hack i put in my local version of libstdc++ to get things
minimally working.  It would need some work before going back into cvs,
though.

Note that i haven't actually tested this in the last month or so; it's
possible that it has broken by now.

sss


2000-02-28  scott snyder  <sss@karma.fnal.gov>

	* config/c_io_libio.cc: basic_file ctor takes lock arg.

1999-12-25  scott snyder  <sss@karma.fnal.gov>

	* bits/basic_file.h: Ctor takes lock arg.
	* bits/std_fstream.h: Add _M_lock.
	* bits/fstream.tcc: Supply it to basic_file ctor.


Index: config/c_io_libio.cc
===================================================================
RCS file: /cvs/libstdc++/libstdc++/config/c_io_libio.cc,v
retrieving revision 1.3
diff -u -p -r1.3 c_io_libio.cc
--- c_io_libio.cc	2000/02/29 20:22:34	1.3
+++ c_io_libio.cc	2000/03/14 22:52:50
@@ -37,8 +37,9 @@
 
 namespace std {
   
-  __basic_file::__basic_file() 
+  __basic_file::__basic_file(_IO_lock_t* __lock) 
   {
+    this->_lock = __lock;
     _IO_init(this, 0);
     _IO_file_init(this); 
   }
Index: bits/basic_file.h
===================================================================
RCS file: /cvs/libstdc++/libstdc++/bits/basic_file.h,v
retrieving revision 1.21
diff -u -p -r1.21 basic_file.h
--- basic_file.h	2000/02/29 20:22:33	1.21
+++ basic_file.h	2000/03/14 22:53:24
@@ -54,7 +54,7 @@ namespace std {
 #endif
 
   public:
-    __basic_file();
+    __basic_file(_IO_lock_t* __lock = 0);
 
     // Eqivalent to the normal fopen function.
     __basic_file* 
Index: bits/std_fstream.h
===================================================================
RCS file: /cvs/libstdc++/libstdc++/bits/std_fstream.h,v
retrieving revision 1.73
diff -u -p -r1.73 std_fstream.h
--- std_fstream.h	2000/03/10 04:07:01	1.73
+++ std_fstream.h	2000/03/14 22:54:02
@@ -38,6 +38,7 @@
 #include <bits/std_ostream.h>
 #include <bits/basic_file.h>
 #include <bits/std_locale.h>	// For codecvt
+#include <pthread.h>
 
 namespace std {
 
@@ -70,6 +71,7 @@ namespace std {
       __state_type		_M_state_cur;// Current state type for codecvt.
       __state_type 		_M_state_beg; 	
       const __codecvt_type*	_M_fcvt;       // Cached value from use_facet.
+      pthread_mutex_t           _M_lock;
 
     public:
       // Constructors/destructor:
Index: bits/fstream.tcc
===================================================================
RCS file: /cvs/libstdc++/libstdc++/bits/fstream.tcc,v
retrieving revision 1.41
diff -u -p -r1.41 fstream.tcc
--- fstream.tcc	2000/01/14 11:24:01	1.41
+++ fstream.tcc	2000/03/14 22:54:10
@@ -45,7 +45,7 @@ namespace std
       _M_fcvt = &use_facet<__codecvt_type>(this->getloc());
       _M_buf_size = static_cast<int_type>(BUFSIZ * sizeof(char_type)); 
       try {
-	_M_file = new __file_type;
+	_M_file = new __file_type (&_M_lock);
       }
       catch(...) {
 	delete _M_file;


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