http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55546
Bug #: 55546 Summary: Static functions that are fully inlined can end up in the object file Classification: Unclassified Product: gcc Version: 4.7.2 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c AssignedTo: unassig...@gcc.gnu.org ReportedBy: ro...@rohanlean.de Created attachment 28838 --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=28838 A rather minimal test-case for the bug. If a static function has its address taken in the C code, but due to optimisations the address is never used, then the function can still end up in the object file. I have attached a file to demonstrate the bug. When I compile it with -std=c11 -O3, the resulting executable will contain code for f, even though it is not needed. (As an aside, if you add another function similar to f, and call h with each of them, then gcc will not resolve things so nicely at compile time and also emit code for h.)