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]
Other format: [Raw text]

[Bug c++/11111] New: Exception in shared library gets only caught when lib is process local


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.


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