This is the mail archive of the gcc@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]

PR 8805: EH vs. CFG


This test case ends up generating a function with huge number of
exception handlers.  Essentially, the function looks like:

  try {
    construct ();
    try { 
      construct ();
    } catch (...) {
      destroy ();
    }
  } catch (...) {
    destroy ();
  }

with many, many levels of nesting.

This results in quadratic blow-up in the compiler.  The reason seems
to be that reachable_handlers returns a long list of handlers for each
place that can throw an exception.  That seems weird; why not just
stop after finding the first one?

The cause, in the code, is that reachable_next_level stops when it
finds a RNL_CAUGHT region -- but cleanup handlers are only
RNL_MAYBE_CAUGHT regions.  It seems to me that we should stop after
RNL_MAYBE_CAUGHT regions too, in this case; each cleanup handler
should have an edge to the places it can transfer control to next,
so we don't need them from the original place.

In that case, we could introduce RNL_CLEANUP -- which would be treated
like RNL_MAYBE_CAUGHT in most places, but like RNL_CAUGHT in
reachable_next_level.

Thoughts?

--
Mark Mitchell                   mark at codesourcery dot com
CodeSourcery, LLC               http://www.codesourcery.com


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