------- Comment #7 from rguenth at gcc dot gnu dot org  2009-09-09 13:28 -------
This is because we now emit thunks for the (unused) destructor.  The following
seems to work for both testcases, testing is pending

Index: cgraphunit.c
===================================================================
--- cgraphunit.c        (revision 151557)
+++ cgraphunit.c        (working copy)
@@ -1036,7 +1036,8 @@ cgraph_emit_thunks (void)
         emitted, but we cannot know that until the inliner and other
         IPA passes have run (see the sequencing of the call to
         cgraph_mark_functions_to_output in cgraph_optimize).  */
-      if (!DECL_EXTERNAL (n->decl))
+      if (n->reachable
+         && !DECL_EXTERNAL (n->decl))
        lang_hooks.callgraph.emit_associated_thunks (n->decl);
     }
 }
@@ -1053,10 +1054,6 @@ cgraph_finalize_compilation_unit (void)
   /* Emit size functions we didn't inline.  */
   finalize_size_functions ();

-  /* Emit thunks, if needed.  */
-  if (lang_hooks.callgraph.emit_associated_thunks)
-    cgraph_emit_thunks ();
-
   /* Call functions declared with the "constructor" or "destructor"
      attribute.  */
   cgraph_build_cdtor_fns ();
@@ -1067,10 +1064,20 @@ cgraph_finalize_compilation_unit (void)
       fflush (stderr);
     }

+  /* Gimplify and lower all functions, compute reachability and
+     remove unreachable nodes.  */
+  timevar_push (TV_CGRAPH);
+  cgraph_analyze_functions ();
+  timevar_pop (TV_CGRAPH);
+
+  /* Emit thunks for reachable nodes, if needed.  */
+  if (lang_hooks.callgraph.emit_associated_thunks)
+    cgraph_emit_thunks ();
+
   /* Mark alias targets necessary and emit diagnostics.  */
   finish_aliases_1 ();

-  /* Gimplify and lower all functions.  */
+  /* Gimplify and lower thunks.  */
   timevar_push (TV_CGRAPH);
   cgraph_analyze_functions ();
   timevar_pop (TV_CGRAPH);


-- 

rguenth at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|REOPENED                    |ASSIGNED
   Last reconfirmed|2009-09-04 17:33:57         |2009-09-09 13:28:36
               date|                            |


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

Reply via email to