https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89139
--- Comment #6 from Marc Nieper-Wißkirchen <m...@nieper-wisskirchen.de> --- Interestingly, the above code, slightly modified, exhibits another problem the optimizer has: void foo (); static void c (void (*w) (void)) { w (); } static void f () { foo (); } static void *x = &f; void g () { c (x); } The only difference consists in that f is not completely trivial but calls some external function. In this case, the code of f is not inlined in g, and we get the non-optimal code (in x86-64 assembly): f: xorl %eax, %eax jmp foo g: jmp f I'm not sure whether I should file in another bug for this example.