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]

SIGSEGV in insert to global container in shared lib



Using EGCS 1.03a compiled on Sparc Solaris 2.6, I've run into problems using
any
standard libraray container at file scope, in a shared library.  (static
linkage??)

First, when I try to use the latest GNU ld to link this code (with -fPIC and
--shared options, of course), ld
dumps core.

I found that the Sun linker will link the code (-G option, of course).  But,
I get a SIGSEGV on the first attempt to insert a value into the container.
(I've tried various template containers, with similar results.)  The same
code works fine if the container is declared in a function, of course.

Eg,  from any program call into foo() in libfile.so as follows: 

// file.cc

#include <set>

set<int> set_of_int;


extern "C" {

foo() {  set_of_int.insert(1); }

}



Matt Benjamin
mbenjamin@comshare.com



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