[C++ patch] one more missed mark_used

Mark Mitchell mark@codesourcery.com
Sat Aug 2 20:24:00 GMT 2003


>   static tree
> ! mark_member_pointers (tree *tp, int *walk_subtrees ATTRIBUTE_UNUSED,
> ! 		      void *data ATTRIBUTE_UNUSED)
>   {
>     if (TREE_CODE (*tp) == PTRMEM_CST
>         && TYPE_PTRMEMFUNC_P (TREE_TYPE (*tp)))
>       cgraph_mark_needed_node (cgraph_node (PTRMEM_CST_MEMBER (*tp)), 1);
>     return 0;
>   }
>   
> --- 2561,2588 ----
>   /* Callgraph code does not understand the member pointers.  Mark the methods
>      referenced as used.  */
>   static tree
> ! mark_member_pointers_and_eh_handlers (tree *tp,
> ! 				      int *walk_subtrees,
> ! 		      		      void *data ATTRIBUTE_UNUSED)
>   {
> +   /* Avoid useless walking of complex type and declaration nodes.  */
> +   if (TYPE_P (*tp) || DECL_P (*tp))

You should be careful about this test.  For example, I expect that you
will now not walk the initializers of declarations, which might contain
pointers-to-members, or statement-expressions containing try/catch
blocks.

This code:

+   if (type)
+     {
+       tree tinfo = get_tinfo_decl (type);
+       mark_used (tinfo);
+     }

will penalize not-function-at-a-time mode compilation because it will
result in generating additional typeinfos, even when the back end
optimizes away the handlers.

So, this is not OK.

-- 
Mark Mitchell
CodeSourcery, LLC
mark@codesourcery.com



More information about the Gcc-patches mailing list