This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/11111] New: Exception in shared library gets only caught when lib is process local
- From: "joerg dot richter at pdv-fs dot de" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 6 Jun 2003 14:18:32 -0000
- Subject: [Bug c++/11111] New: Exception in shared library gets only caught when lib is process local
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11111
Summary: Exception in shared library gets only caught when lib is
process local
Product: gcc
Version: 3.3
Status: UNCONFIRMED
Severity: major
Priority: P2
Component: c++
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: joerg.richter@pdv-fs.de
CC: gcc-bugs@gcc.gnu.org
GCC build triplet: powerpc-ibm-aix5.1.0.0
GCC host triplet: powerpc-ibm-aix5.1.0.0
GCC target triplet: powerpc-ibm-aix5.1.0.0
How to reproduce:
Create this 2 files
----- main.cc -----
#include <cstdio>
void function();
int main()
{
try
{
function();
}
catch( ... )
{
printf("catch\n");
}
return 0;
}
----- sh.cc -----
#include <cstdio>
int function()
{
printf( "throw\n" );
throw 5;
return 0;
}
----------
Execute following commands:
export CC=/tools/pkg/gcc/3.3/bin/g++
$CC -c -o main.o main.cc
$CC -c -o sh.o sh.cc
$CC -shared -o libsh.so sh.o
$CC -o main main.o -L. -Wl,-brtl -lsh
# throws and aborts
./main
chmod o-r libsh.so
slibclean
# throws and catches
./main
----------
With chmod o-r you can make a shared library process local. This means all
processes using this library get their own copy. slibclean clears the library
cache.
This works with GCC 3.2.1 & same host.
Note: There is a similar bug i wanted to track down with this test case. Also
related to shared libraries and exceptions. But the other bug happens until now
only in large applications.
The other bug is present in 3.2.1 AND 3.3. And does NOT disappear with the
descriped workaround.
Perhaps the fix to this bug fixes the other one too.