A very simple exception test case results in an abort trap:

host% cat exctest.cpp
struct StackThing {
    ~StackThing() { }
};
struct Thrower {
    static void Throw() {
        StackThing obj;
        throw -1;
    }
};
int main() {
    try {
        Thrower::Throw();
    } catch (...) { }
}

host% g++-4.4.3 exctest.cpp && ./a.out
Abort trap
host%

The problem is absent if the exception and stack object are not in a thrower
function, or if the stack object has no destructor.

This is using an all-defaults build of the 4.4.3 tarball on MacOS X 10.6.2
(Darwin Kernel Version 10.2.0: Tue Nov 3 10:37:10 PST 2009;
root:xnu-1486.2.11~1/RELEASE_I386 i386)


-- 
           Summary: thrower function with inlined stack destructor crash on
                    darwin
           Product: gcc
           Version: 4.4.3
            Status: UNCONFIRMED
          Severity: major
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: larsfolser at gmail dot com
  GCC host triplet: 4.4.3
GCC target triplet: 4.4.3


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

Reply via email to