http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49653
--- Comment #10 from Jonathan Wakely <redi at gcc dot gnu.org> 2011-07-07 17:08:54 UTC --- The point is your code is invalid and the compiler's behaviour at -O0 is correct. C99 6.9 "If an identifier declared with external linkage is used in an expression (other than as part of the operand of a sizeof operator whose result is an integer constant), somewhere in the entire program there shall be exactly one external definition for the identifier; otherwise, there shall be no more than one." You get away with the invalid program with optimisation but that doesn't make it correct. If the compiler decided not to inline the function because of its size or the amount of inlining it had already done, or a user compiled the code with -fno-inline-functions -O3, then the code would fail to link again. The solution is not to modify the compiler, but to fix the code. Either make the function static (so no external definition is needed) or ensure an external definition is present in some translation unit (or as a GNU extension mark it "always_inline" so you get away without referencing the external definition.)