The following code calls terminate() at runtime because copying the exception
object into the catch parameter throws an exception:

struct A
{
  A() { }
  A (const A&) { throw 1; }
};

int main()
{
  try
    {
      throw A();
    }
  catch (A) { }
}

In G++ 3.4 this was handled by just leaving the copy constructor call out of
the LSDA action table, so the personality function knew to call terminate.  As
of the tree-ssa merge, this changed so that we started emitting code to check
the exception against a random filter and then call terminate from within the
function.  This is a significant code size regression: a 25% jump in text size
from 3.4 to 4.0.

4.0 and up also unnecessarily think that __cxa_end_catch might throw; since A
has a trivial destructor, it can't throw in this case.


-- 
           Summary: [4.3/4.4/4.5/4.6 Regression] G++ emits unnecessary EH
                    code
           Product: gcc
           Version: 4.6.0
            Status: UNCONFIRMED
          Keywords: missed-optimization
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: jason at gcc dot gnu dot org
        ReportedBy: jason at gcc dot gnu dot org


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

Reply via email to