https://gcc.gnu.org/bugzilla/show_bug.cgi?id=42497
Peter Cordes <peter at cordes dot ca> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |peter at cordes dot ca --- Comment #3 from Peter Cordes <peter at cordes dot ca> --- This bug is still present with gcc 5.2 -O3 (which does include -foptimize-sibling-calls). void fire_special_event(void); void conditional_call(int cond) { if(cond) fire_special_event(); } The above code compiles to (x86-64 gcc 5.2 -O3) testl %edi, %edi jne .L4 rep ret .L4: jmp fire_special_event This sequence would be better: testl %edi, %edi jne fire_special_event ret godbolt link: https://goo.gl/0K6EZx Later functions in that listing are related to http://stackoverflow.com/questions/97987/advantage-of-switch-over-if-else-statement Is there a linker limitation on relocations for conditional-branch targets that aren't part of the current compilation unit? neither clang 3.7 nor icc 13 do any better than gcc. It seems to work for me when modifying the asm by hand to jnz _Z18fire_special_eventv, and linking to a separately-compiled definition.