From 69a4e898c8f508f0c56c72c791a38bc432e9fa69 Mon Sep 17 00:00:00 2001 From: Jan Hubicka Date: Sun, 17 Apr 2016 18:04:05 +0200 Subject: re PR c++/70018 (Possible issue around IPO and C++ comdats discovered as pure/const) PR ipa/70018 * cgraph.h (cgraph_node::set_const_flag, cgraph_node::set_pure_flag): Update prototype to return bool; update comment. * cgraph.c (cgraph_node::call_for_symbol_thunks_and_aliases): Thunks of interposable symbol are interposable, too. (cgraph_set_const_flag_1): Rename to ... (set_const_flag_1): ... this one; change to self recursive function instead of call_for_symbol_thunks_and_aliases. Handle correctly clearnig the flag in all variants and also virtual thunks of const functions are pure; track if any change was done. (cgraph_node::set_const_flag): Update. (struct set_pure_flag_info): New struct. (cgraph_set_pure_flag_1): Rename to ... (set_pure_flag_1): ... this one; take set_pure_flag_info parameter rather than pointer encoded flags; track if any changes was done; handle correctly clearning flag and setting flag of aliases already declared const. (cgraph_node::set_pure_flag): Update. (cgraph_node::set_nothrow_flag): Handle correctly clearning the flag. From-SVN: r235081 --- gcc/cgraph.h | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) (limited to 'gcc/cgraph.h') diff --git a/gcc/cgraph.h b/gcc/cgraph.h index 5b2b4bc..71e31a4 100644 --- a/gcc/cgraph.h +++ b/gcc/cgraph.h @@ -1113,13 +1113,24 @@ public: if any to NOTHROW. */ void set_nothrow_flag (bool nothrow); - /* Set TREE_READONLY on cgraph_node's decl and on aliases of the node - if any to READONLY. */ - void set_const_flag (bool readonly, bool looping); + /* If SET_CONST is true, mark function, aliases and thunks to be ECF_CONST. + If SET_CONST if false, clear the flag. + + When setting the flag be careful about possible interposition and + do not set the flag for functions that can be interposet and set pure + flag for functions that can bind to other definition. + + Return true if any change was done. */ + + bool set_const_flag (bool set_const, bool looping); /* Set DECL_PURE_P on cgraph_node's decl and on aliases of the node - if any to PURE. */ - void set_pure_flag (bool pure, bool looping); + if any to PURE. + + When setting the flag, be careful about possible interposition. + Return true if any change was done. */ + + bool set_pure_flag (bool pure, bool looping); /* Call callback on function and aliases associated to the function. When INCLUDE_OVERWRITABLE is false, overwritable aliases and thunks are -- cgit v1.1