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]

(LibC++v3) Problem with eh_catch.cc and rethrown exceptions on i586-pc-mingw32 (and quick-fix)


With any of the testsuite cases that rethrow an exception (eg
testsuite/g++.old-deja/g++.eh/rethrow1.C, ) I get a SIGSEGV in
libsupc++/eh_catch.cc, here:

extern "C" void
__cxa_end_catch ()
{
  __cxa_eh_globals * globals = __cxa_get_globals_fast ();
  __cxa_exception *header = globals->caughtExceptions;
  int count = header->handlerCount;

  if (count < 0)
    {
      // This exception was rethrown.  Decrement the (inverted) catch
      // count and remove it from the chain when it reaches zero.
      if (++count == 0)
	{
	  globals->uncaughtExceptions += 1; // <<<< Access violation 
	  globals->caughtExceptions = header->nextException;
	}, 


If I put add in a printf, like so: 

  __cxa_eh_globals *  globals = __cxa_get_globals_fast ();
  printf("%s: Address of eh_globals:Ox%x\n",__FUNCTION__, globals); 

or make the pointer volatile, like so:

 __cxa_eh_globals * volatile  globals = __cxa_get_globals_fast ();

then all the rethrow testcases work okay with both single-thread and
-mthread.


GCC was configured as:
Reading specs from D:/MINGW/BIN/../lib/gcc-lib/mingw32/3.1/specs
Configured with: ../gcc/configure
--with-gcc-version-trigger=/develop/gcc/gcc/gcc/version.c --with-gcc
--with-gnu-ld --with-gnu-as --host=mingw32-i586 --target=mingw32-i586
--prefix=/mingw --enable-sjlj-exceptions --enable-threads --disable-nls
--enable-languages=f77,c++,objc,ada --disable-win32-registry
--disable-shared --enable-objc-gc : (reconfigured)
Thread model: win32
gcc version 3.1 20020218 (experimental)

Is this exposing a latent bug somewhere else?

Danny

http://movies.yahoo.com.au - Yahoo! Movies
- Vote for your nominees in our online Oscars pool.


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