https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63892
--- Comment #23 from Iain Sandoe <iains at gcc dot gnu.org> --- (In reply to Iain Sandoe from comment #22) > yeah, it's not right yet.. looking at this: > diff --git a/gcc/ipa-icf.c b/gcc/ipa-icf.c > index e1af8bf..3b5553e 100644 > --- a/gcc/ipa-icf.c > +++ b/gcc/ipa-icf.c > @@ -658,13 +658,16 @@ sem_function::merge (sem_item *alias_item) > create_thunk = !stdarg_p (TREE_TYPE (alias->decl)); > create_alias = false; > /* When both alias and original are not overwritable, we can save > - the extra thunk wrapper for direct calls. */ > + the extra thunk wrapper for direct calls (providing that there > + are no other referring entries). */ > redirect_callers > = (!original_discardable > && !DECL_COMDAT_GROUP (alias->decl) > && alias->get_availability () > AVAIL_INTERPOSABLE > && original->get_availability () > AVAIL_INTERPOSABLE > - && !alias->instrumented_version); > + && !alias->instrumented_version > + && alias->ref_list.referring.is_empty() > + ); > } > else > { so overnight testing shows that this regresses iinline-5.c on Linux (the generated asm is the same barring label names, and the exe runs, but the dump scan fails). However, it completely trashes Java (on Darwin only) so (a) there appears to be some Java code-gen that needs functions marked as virtual, externally-visible, but with no callers and no referrers)… needs some debugging. (b) Under what circumstances is it correct to remove an alias that has referrers? (since Linux seems to be doing that, and fails the iinline-5.c test without). ( c) there are other C/C++ test regressions on Darwin still - so more debugging is needed.