[PATCH] Properly register dead cgraph_nodes in passes.c.

Martin Sebor msebor@gmail.com
Fri Aug 9 15:33:00 GMT 2019


On 8/9/19 6:41 AM, Martin Liška wrote:
> Hi.
> 
> The patch prevents crashes caused by fact that do_per_function_toporder
> uses get_uid () to register all dead cgraph_nodes. That does not work
> now as cgraph_nodes are directly released via ggc_free and so that one
> will see a garbage here. Second steps is to register all cgraph hooks
> and correctly hold add removed nodes. Doing that we'll not need the GGC nodes
> array.
> 
> Patch can bootstrap on x86_64-linux-gnu and survives regression tests.
> I can also build xalancbmk with -O2 -ffast-math where I previously saw
> the ICE.

Just a comment on "style:" to make code more readable, GCC
coding conventions call for variables to be defined at the same
time as they're initialized (if possible).  There's still lots
of legacy C89 code that defines variables at the beginning of
a function and initializes them much later, but in new C and
C++ code we have the opportunity to follow it.

Martin

PS For some additional background see DCL19-C in the CERT C
Coding Standard.  A warning that helped find opportunities to
reduce the scope of variables would be quite useful.

> 
> Ready to be installed?
> Thanks,
> Martin
> 
> gcc/ChangeLog:
> 
> 2019-08-09  Martin Liska  <mliska@suse.cz>
> 
> 	PR ipa/91404
> 	* passes.c (order): Remove.
> 	(uid_hash_t): Likewise).
> 	(remove_cgraph_node_from_order): Remove from set
> 	of pointers (cgraph_node *).
> 	(insert_cgraph_node_to_order): New.
> 	(duplicate_cgraph_node_to_order): New.
> 	(do_per_function_toporder): Register all 3 cgraph hooks.
> 	Skip removed_nodes now as we know about all of them.
> ---
>   gcc/passes.c | 69 +++++++++++++++++++++++++++++++++-------------------
>   1 file changed, 44 insertions(+), 25 deletions(-)
> 
> 



More information about the Gcc-patches mailing list