This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
SIGSEGV in insert to global container in shared lib
- To: egcs-bugs at cygnus dot com
- Subject: SIGSEGV in insert to global container in shared lib
- From: Matthew Benjamin <MBenjamin at comshare dot com>
- Date: Wed, 24 Jun 1998 14:48:00 -0400
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