From 72b3bc895f023bf451357659cfe96c966945bdf9 Mon Sep 17 00:00:00 2001 From: Jan Hubicka Date: Fri, 20 Mar 2020 22:06:24 +0100 Subject: Fix verifier ICE on wrong comdat local flag [PR93347] gcc/ChangeLog: 2020-03-20 Jan Hubicka PR ipa/93347 * cgraph.c (symbol_table::create_edge): Update calls_comdat_local flag. (cgraph_edge::redirect_callee): Move here; likewise. (cgraph_node::remove_callees): Update calls_comdat_local flag. (cgraph_node::verify_node): Verify that calls_comdat_local flag match reality. (cgraph_node::check_calls_comdat_local_p): New member function. * cgraph.h (cgraph_node::check_calls_comdat_local_p): Declare. (cgraph_edge::redirect_callee): Move offline. * ipa-fnsummary.c (compute_fn_summary): Do not compute calls_comdat_local flag here. * ipa-inline-transform.c (inline_call): Fix updating of calls_comdat_local flag. * ipa-split.c (split_function): Use true instead of 1 to set the flag. * symtab.c (symtab_node::add_to_same_comdat_group): Update calls_comdat_local flag. gcc/testsuite/ChangeLog: 2020-03-20 Jan Hubicka * g++.dg/torture/pr93347.C: New test. --- gcc/cgraph.h | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) (limited to 'gcc/cgraph.h') diff --git a/gcc/cgraph.h b/gcc/cgraph.h index aa4cdc95506..43de3b4a8ac 100644 --- a/gcc/cgraph.h +++ b/gcc/cgraph.h @@ -1326,6 +1326,10 @@ struct GTY((tag ("SYMTAB_FUNCTION"))) cgraph_node : public symtab_node /* Return true if this node represents a former, i.e. an expanded, thunk. */ inline bool former_thunk_p (void); + /* Check if function calls comdat local. This is used to recompute + calls_comdat_local flag after function transformations. */ + bool check_calls_comdat_local_p (); + /* Return true if function should be optimized for size. */ bool optimize_for_size_p (void); @@ -3298,19 +3302,6 @@ cgraph_edge::set_callee (cgraph_node *n) callee = n; } -/* Redirect callee of the edge to N. The function does not update underlying - call expression. */ - -inline void -cgraph_edge::redirect_callee (cgraph_node *n) -{ - /* Remove from callers list of the current callee. */ - remove_callee (); - - /* Insert to callers list of the new callee. */ - set_callee (n); -} - /* Return true when the edge represents a direct recursion. */ inline bool -- cgit v1.2.3