[Bug libstdc++/51135] New: SIGSEGV during exception cleanup on win32

gurnec-bugz at gis dot net gcc-bugzilla@gcc.gnu.org
Tue Nov 15 05:21:00 GMT 2011


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51135

             Bug #: 51135
           Summary: SIGSEGV during exception cleanup on win32
    Classification: Unclassified
           Product: gcc
           Version: 4.7.0
            Status: UNCONFIRMED
          Severity: major
          Priority: P3
         Component: libstdc++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: gurnec-bugz@gis.net


It looks like __thiscall is now the default calling convention for member
functions (where possible) for win32 targets. This seems to have broken
exception cleanup. 

This seg faults when executed (and compiled by mingw-32):

===============
struct except {
  virtual ~except() {}
};

int main() {
  try {
    throw except();
  } catch(except) {
  }
}
===============

The seg fault occurs after the catch block is exited, and except::~except() is
called by the runtime. I think __gxx_exception_cleanup (in
libstdc++-v3/libsupc++/eh_throw.cc) is still trying to call except::~except()
using the old calling convention, resulting in a seg fault on any access to
'this'.

-Chris



More information about the Gcc-bugs mailing list