This is the mail archive of the gcc-prs@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]

c++/9597: Exception crash in shared library on Solaris 2.8 Intel platform


>Number:         9597
>Category:       c++
>Synopsis:       Exception crash in shared library on Solaris 2.8 Intel platform
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu Feb 06 14:46:00 UTC 2003
>Closed-Date:
>Last-Modified:
>Originator:     gcc
>Release:        3.2.1
>Organization:
>Environment:
Solaris 2.8 Intel
>Description:
Hi,

I got a crash when i throw an exception in a shared library.
I use gcc 3.2.1 on Solaris 2.8 i386 Intel Platform.

gcc -v:

Reading specs from /usr/lib/gcc-lib/i386-pc-solaris2.8/3.2.1/specs
Configured with: ./configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --enable-shared --enable-threads=posix --with-gnu-ld --with-ld=/usr/bin/ld --with-gnu-nm --with-nm=/usr/bin/nm --with-gnu-as --with-as=/usr/bin/as
Thread model: posix
gcc version 3.2.1

Shared Library Source code:

////// Lib

#include <stdio.h>
#include <iostream>

extern "C" bool test(void)
{
return true;
}

extern "C" void _init(void)
{
std::cout << "_init" << std::endl;

try
{
int toto=15;
throw(toto);
}
catch (int& truc)
{
std::cout << truc << std::endl;
}
}

Compil result:

g++ -v -fexceptions -Wno-deprecated -O0 -g3 -I/sources/Opalis/DVT4/ToolKit/ -L/sources/Opalis/DVT4/lib/ -DINTEL -DSOLARIS -DUNIX -D_GNU_SOURCE -DOS_MULTI_THREADED -DOS_SOLARIS_2_7 -DOS_SOLARIS_PTHREADS -DOS_PTHREADS -DOS_REALTIME -D_REENTRANT -DOS_NO_WSTRING -DOS_USE_STD_IOSTREAMS -c -o main_lib.o main_lib.cpp
Reading specs from /usr/lib/gcc-lib/i386-pc-solaris2.8/3.2.1/specs
Configured with: ./configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --enable-shared --enable-threads=posix --with-gnu-ld --with-ld=/usr/bin/ld --with-gnu-nm --with-nm=/usr/bin/nm --with-gnu-as --with-as=/usr/bin/as
Thread model: posix
gcc version 3.2.1
/usr/lib/gcc-lib/i386-pc-solaris2.8/3.2.1/cc1plus -v -I/sources/Opalis/DVT4/ToolKit/ -D__GNUC__=3 -D__GNUC_MINOR__=2
-D__GNUC_PATCHLEVEL__=1 -D__GXX_ABI_VERSION=102 -Dunix -D__svr4__ -D__SVR4 -Dsun -D__PRAGMA_REDEFINE_EXTNAME -D__unix__ -D__svr4__ -D__SVR4 -D__sun__ -D__PRAGMA_REDEFINE_EXTNAME -D__unix -D__sun -Asystem=svr4 -D__NO_INLINE__ -D__STDC_HOSTED__=1 -dD -D_XOPEN_SOURCE=500 -D_LARGEFILE_SOURCE=1 -D_LARGEFILE64_SOURCE=1 -D__EXTENSIONS__ -Acpu=i386 -Amachine=i386 -Di386 -D__i386 -D__i386__ -D__tune_i386__ -DINTEL -DSOLARIS -DUNIX -D_GNU_SOURCE -DOS_MULTI_THREADED -DOS_SOLARIS_2_7 -DOS_SOLARIS_PTHREADS -DOS_PTHREADS -DOS_REALTIME -D_REENTRANT -DOS_NO_WSTRING -DOS_USE_STD_IOSTREAMS main_lib.cpp -D__GNUG__=3 -D__EXCEPTIONS -quiet -dumpbase main_lib.cpp -g3 -O0 -Wno-deprecated -version -fexceptions -o /var/tmp//ccSTajtv.s
GNU CPP version 3.2.1 (cpplib) (i386 System V Release 4)
GNU C++ version 3.2.1 (i386-pc-solaris2.8)
compiled by GNU C version 3.2.1.
ignoring nonexistent directory "/usr/i386-pc-solaris2.8/include"
#include "..." search starts here:
#include <...> search starts here:
/sources/Opalis/DVT4/ToolKit
/usr/include/c++/3.2.1
/usr/include/c++/3.2.1/i386-pc-solaris2.8
/usr/include/c++/3.2.1/backward
/usr/local/include
/usr/lib/gcc-lib/i386-pc-solaris2.8/3.2.1/include
/usr/include
End of search list.
/usr/bin/as --traditional-format -V -Qy -o main_lib.o /var/tmp//ccSTajtv.s
GNU assembler version 2.13.2 (i386-pc-solaris2.8) using BFD version 2.13.2 20021220
g++ -I/sources/Opalis/DVT4/ToolKit/ -L/sources/Opalis/DVT4/lib/ -nostartfiles -g -shared -W1,-soname,lib.dl -o lib.dl main_lib.o -lc

Exec source code:

//////

#include <dlfcn.h>
#include <iostream>
#include <link.h>

typedef bool (* test_fnc)(void);
bool test(void);

int main(int argv, char* argc)
{
void* dl_handle = dlopen("./lib.dl", RTLD_NOW);

if (!dl_handle)
{
std::cout << "Error:" << dlerror() << std::endl;
return 1;
}

//
test_fnc test = (test_fnc) dlsym(dl_handle, "test");

(*test)();


dlclose(dl_handle);

return (0);
}

Compil Result:

g++ -v -fexceptions -Wno-deprecated -O0 -g3 -I/sources/Opalis/DVT4/ToolKit/ -L/sources/Opalis/DVT4/lib/ -DINTEL -DS
OLARIS -DUNIX -D_GNU_SOURCE -DOS_MULTI_THREADED -DOS_SOLARIS_2_7 -DOS_SOLARIS_PTHREADS -DOS_PTHREADS -DOS_REALTIME -D_
REENTRANT -DOS_NO_WSTRING -DOS_USE_STD_IOSTREAMS -c -o main_exe.o main_exe.cpp
Reading specs from /usr/lib/gcc-lib/i386-pc-solaris2.8/3.2.1/specs
Configured with: ./configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --enable-shared --enable-threads=
posix --with-gnu-ld --with-ld=/usr/bin/ld --with-gnu-nm --with-nm=/usr/bin/nm --with-gnu-as --with-as=/usr/bin/as
Thread model: posix
gcc version 3.2.1
/usr/lib/gcc-lib/i386-pc-solaris2.8/3.2.1/cc1plus -v -I/sources/Opalis/DVT4/ToolKit/ -D__GNUC__=3 -D__GNUC_MINOR__=2
-D__GNUC_PATCHLEVEL__=1 -D__GXX_ABI_VERSION=102 -Dunix -D__svr4__ -D__SVR4 -Dsun -D__PRAGMA_REDEFINE_EXTNAME -D__unix_
_ -D__svr4__ -D__SVR4 -D__sun__ -D__PRAGMA_REDEFINE_EXTNAME -D__unix -D__sun -Asystem=svr4 -D__NO_INLINE__ -D__STDC_HO
STED__=1 -dD -D_XOPEN_SOURCE=500 -D_LARGEFILE_SOURCE=1 -D_LARGEFILE64_SOURCE=1 -D__EXTENSIONS__ -Acpu=i386 -Amachine=i
386 -Di386 -D__i386 -D__i386__ -D__tune_i386__ -DINTEL -DSOLARIS -DUNIX -D_GNU_SOURCE -DOS_MULTI_THREADED -DOS_SOLARIS
_2_7 -DOS_SOLARIS_PTHREADS -DOS_PTHREADS -DOS_REALTIME -D_REENTRANT -DOS_NO_WSTRING -DOS_USE_STD_IOSTREAMS main_exe.cp
p -D__GNUG__=3 -D__EXCEPTIONS -quiet -dumpbase main_exe.cpp -g3 -O0 -Wno-deprecated -version -fexceptions -o /var/tmp/
/ccn0iCnL.s
GNU CPP version 3.2.1 (cpplib) (i386 System V Release 4)
GNU C++ version 3.2.1 (i386-pc-solaris2.8)
compiled by GNU C version 3.2.1.
ignoring nonexistent directory "/usr/i386-pc-solaris2.8/include"
#include "..." search starts here:
#include <...> search starts here:
/sources/Opalis/DVT4/ToolKit
/usr/include/c++/3.2.1
/usr/include/c++/3.2.1/i386-pc-solaris2.8
/usr/include/c++/3.2.1/backward
/usr/local/include
/usr/lib/gcc-lib/i386-pc-solaris2.8/3.2.1/include
/usr/include
End of search list.
/usr/bin/as --traditional-format -V -Qy -o main_exe.o /var/tmp//ccn0iCnL.s
GNU assembler version 2.13.2 (i386-pc-solaris2.8) using BFD version 2.13.2 20021220
g++ -v -fexceptions -Wno-deprecated -O0 -g3 -I/sources/Opalis/DVT4/ToolKit/ -L/sources/Opalis/DVT4/lib/ -DINTEL -DS
OLARIS -DUNIX -D_GNU_SOURCE -DOS_MULTI_THREADED -DOS_SOLARIS_2_7 -DOS_SOLARIS_PTHREADS -DOS_PTHREADS -DOS_REALTIME -D_
REENTRANT -DOS_NO_WSTRING -DOS_USE_STD_IOSTREAMS main_exe.o -o exe
Reading specs from /usr/lib/gcc-lib/i386-pc-solaris2.8/3.2.1/specs
Configured with: ./configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --enable-shared --enable-
threads=posix -enable-languages=c,c++ --with-gnu-as --with-as=/usr/bin/as --with-gnu-ld --with-ld=/usr/bin/ld : (recon
figured) ./configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --enable-shared --enable-threads=
posix --with-gnu-ld --with-ld=/usr/bin/ld --with-gnu-nm --with-nm=/usr/bin/nm --with-gnu-as --with-as=/usr/bin/as
Thread model: posix
gcc version 3.2.1
/usr/lib/gcc-lib/i386-pc-solaris2.8/3.2.1/collect2 -V -Y P,/usr/ccs/lib:/usr/lib -Qy -o exe /usr/lib/gcc-lib/i386-pc-
solaris2.8/3.2.1/crt1.o /usr/lib/gcc-lib/i386-pc-solaris2.8/3.2.1/crti.o /usr/ccs/lib/values-Xa.o /usr/lib/gcc-lib/i38
6-pc-solaris2.8/3.2.1/crtbegin.o -L/sources/Opalis/DVT4/lib/ -L/usr/lib/gcc-lib/i386-pc-solaris2.8/3.2.1 -L/usr/ccs/bi
n -L/usr/ccs/lib -L/usr/lib/gcc-lib/i386-pc-solaris2.8/3.2.1/../../.. main_exe.o -lstdc++ -lm -lgcc_s -lgcc -lc -lgcc_
s -lgcc /usr/lib/gcc-lib/i386-pc-solaris2.8/3.2.1/crtend.o /usr/lib/gcc-lib/i386-pc-solaris2.8/3.2.1/crtn.o
GNU ld version 2.13.2 20021220
Supported emulations:
elf_i386_ldso
elf_i386

Please help me.
Thranks.

Pascal.
>How-To-Repeat:
Just compile the library and the executable. And run it.
>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted:


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