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

--- Comment #3 from mark at jarv dot in ---
I notice that lookup_stmt_eh_lp(icall_stmt) at value-prof.c:1272 returns -1.

Elsewhere in the code (tree-eh.c:2208), I see "lp_nr <= 0" as a guard against
further EH processing.

At gimple-pretty-print.c:1881, I see that a negative lp_nr is pretty-printed as
("[MNT %d]", -lp_nr).  Further searching around suggests that "MNT" might mean
"must not throw".

Notably, we're in a destructor in C++11 here, and I guess C++11 destructors are
more often noexcept than in C++98.  From
http://stackoverflow.com/q/15721544/228142:

'12.4/3: "A declaration of a destructor that does not have an
exception-specification is implicitly considered to have the same
exception-specification as an implicit declaration (15.4)." i.e. a destructor
is only noexcept(true) if all the members and bases have a noexcept
destructor.'

Could the correct fix be as simple as:

--- value-prof.c.orig    2013-12-12 10:09:23.148929000 -0500
+++ value-prof.c    2013-12-12 10:57:33.329980000 -0500
@@ -1270,7 +1270,7 @@ gimple_ic (gimple icall_stmt, struct cgr

   /* Build an EH edge for the direct call if necessary.  */
   lp_nr = lookup_stmt_eh_lp (icall_stmt);
-  if (lp_nr != 0
+  if (lp_nr > 0
       && stmt_could_throw_p (dcall_stmt))
     {
       edge e_eh, e;

This certainly removes the ICE, but I don't know that I can vouch for its
safety from the perspective of preserving correctness.

Reply via email to