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]

Exception handling is broken with libstdc++-v3


I have reason to believe that your changes to exception handling on
2000-06-26 break the shared libstdc++-v3 on Linux/ia32:

http://gcc.gnu.org/ml/gcc/2000-07/msg00007.html
http://gcc.gnu.org/ml/gcc/2000-07/msg00009.html
http://gcc.gnu.org/ml/gcc-testresults/2000-07/msg00000.html

I am enclosing the testcase from gcc. I got

# ../xgcc -g -B../ catch11.C
# a.out
# ../xgcc -g -B../ ~/tmp/catch11.C _eh.o ../../i686-pc-linux/libstdc++-v3/src/.libs/libstdc++.so -Wl,-rpath,../../i686-pc-linux/libstdc++-v3/src/.libs/
# a.out
# ../xgcc -g -B../ ~/tmp/catch11.C ../../i686-pc-linux/libstdc++-v3/src/.libs/libstdc++.so -Wl,-rpath,../../i686-pc-linux/libstdc++-v3/src/.libs/
# a.out
# gdb a.out
...
(gdb) bt
#0  0x40103301 in __kill () from /lib/libc.so.6
#1  0x40102fbc in raise (sig=6) at ../sysdeps/posix/raise.c:27
#2  0x401046e2 in abort () at ../sysdeps/generic/abort.c:88
#3  0x40063eb5 in get_reg_addr ()
    at /work/gnu/src/gcc-3.0/egcs/gcc/libgcc2.c:3168
#4  0x400641db in throw_helper (eh=0x400daa80, pc=0x80487cb, 
    my_udata=0xbffff894, offset_p=0xbffff890)
    at /work/gnu/src/gcc-3.0/egcs/gcc/libgcc2.c:3168
#5  0x4006444a in __throw () at /work/gnu/src/gcc-3.0/egcs/gcc/libgcc2.c:3168
#6  0x80487cc in fne () at /user/hjl/tmp/catch11.C:21
#7  0x80487e8 in check (e=0xbffff994) at /user/hjl/tmp/catch11.C:29
#8  0x80489e6 in main () at /user/hjl/tmp/catch11.C:59

_eh.o is extracted from libgcc.a. Let me know if you need more
information.

Thanks.

H.J.
---
// Copyright (C) 2000 Free Software Foundation, Inc.
// Contributed by Nathan Sidwell 24 May 2000 <nathan@codesourcery.com>

// we should be able to catch a base a virtual, provided it is accessible by at
// least one public path
// -- public, << private, == virtual
// E<<B==A
// +--C==A
// +<<D==A

struct A {};
struct B : virtual A {};
struct C : virtual A {};
struct D : virtual A {};
struct E : private B, public C, private D {};

extern "C" void abort ();

void fne (E *e)
{
  throw e;
}

void check(E *e)
{
  int caught;
  
  caught = 0;
  try { fne(e); }
  catch(A *p) { caught = 1; if (p != e) abort();}
  catch(...) { abort(); }
  if (!caught) abort();

  caught = 0;
  try { fne(e); }
  catch(B *p) { abort ();}
  catch(...) { caught = 1; }
  if (!caught) abort();

  caught = 0;
  try { fne(e); }
  catch(C *p) { caught = 1; if (p != e) abort();}
  catch(...) { abort(); }
  if (!caught) abort();

  caught = 0;
  try { fne(e); }
  catch(D *p) { abort ();}
  catch(...) { caught = 1; }
  if (!caught) abort();

  return;
}

int main ()
{
  E e;
  
  check (&e);
  check ((E *)0);

  return 0;
}

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