Bug 43277 - thrower function with inlined stack destructor crash on darwin
Summary: thrower function with inlined stack destructor crash on darwin
Status: RESOLVED DUPLICATE of bug 42159
Alias: None
Product: gcc
Classification: Unclassified
Component: target (show other bugs)
Version: 4.4.3
: P3 major
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-03-06 18:15 UTC by Lars Folser
Modified: 2010-07-15 16:58 UTC (History)
7 users (show)

See Also:
Host: x86_64-apple-darwin10.2.0
Target: x86_64-apple-darwin10.2.0
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Lars Folser 2010-03-06 18:15:38 UTC
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)
Comment 1 Jack Howarth 2010-03-06 19:09:21 UTC
This doesn't occur with gcc trunk on x86_64-apple-darwin10 but does for gcc 4.4.3. Perhaps backporting r151960 to avoid compact unwind code on gcc 4.4 branch for darwin10 would solve this.
Comment 2 Jack Howarth 2010-03-06 20:22:43 UTC
r151960 doesn't eliminate the problem in gcc 4.4 branch.
Comment 3 Jack Howarth 2010-03-07 00:00:34 UTC
This bug occurs in both gcc 4.4.3 and 4.4.2 on x86_64-apple-darwin10, however it doesn't occur under x86_64-apple-darwin9. This may be a compatibility issue with the FSF gcc unwinder code executed on the libSystem unwinder under darwin10.
Comment 4 Andrew Pinski 2010-03-07 00:02:08 UTC
This is most likely related to PR 43099.
Comment 5 Jack Howarth 2010-03-07 02:01:40 UTC
I wonder if the remaining failure on *86*-apple-darwin9 for PR41991 could also be due to PR43099?
Comment 6 Andrew Pinski 2010-07-15 16:58:42 UTC

*** This bug has been marked as a duplicate of 42159 ***