https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107931
--- Comment #20 from Jan Hubicka <hubicka at ucw dot cz> --- > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107931 > > --- Comment #17 from rguenther at suse dot de <rguenther at suse dot de> --- > On Mon, 20 Feb 2023, jakub at gcc dot gnu.org wrote: > > > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107931 > > > > --- Comment #16 from Jakub Jelinek <jakub at gcc dot gnu.org> --- > > As discussed elsewhere, always_inline is used in various ways, in some > > users I > > guess would like to see an error if it wasn't inlined, but e.g. the uses in > > glibc for _FORTIFY_SOURCE where many of the standard C or POSIX APIs have > > extern inline wrappers with always_inline and gnu_inline attributes. In > > that > > case always_inline is used there for security reasons (not inlining it means > > the security checks aren't done) but on the other side C/POSIX requires > > &open > > or &printf to work too. > > With GNU extern inline always_inline it would work to never emit bodies > of always_inline functions to get the errors diagnosed at link time. > Possibly standard C inline plus always_inline would work the same if we > then treat the out of line instantiation as the destination for indirect > calls. > > But I think the cgraph code is still not 100% accurate in reflecting > reality with extern inlines (and possibly C 'inline' and instantiations), > since it doesn't treat the inline copy and the out of line copy > separately. Yep, when inline version is replaced by offline version we forget inline version. THis is remainer from one-definition rule work Zack did many years ago. He changed C and C++ frontned to not produce duplciated VAR/FUNCTION_DECLs with same assembler names and do in-place replacements instead. This was never fully finished and we get duplciates in some scnearios. In meantime cgraph knows how to handle this for LTO and we also support weakrefs and syntactic aliases so keeping both definitions around is not too hard from cgraph point of view. We will however need to convince front-ends to not overwrite the original decl holding the extern inline body. Honza