gcc's x86 "RET"-machine instruction optimization

Ian Lance Taylor ian@airs.com
Mon Aug 1 17:19:00 GMT 2005

Josef Angermeier <sijoange@cip.informatik.uni-erlangen.de> writes:

> GCC uses a jmp-instruction instead of a call one, so 'speeds up' execution by
> saving the execution of bios_16_xxxx's return instruction (lretw one). This of course
> ruins my efforts. Therfore i'd like to know how this optimization is called, and if
> there is any gcc option to disable this particular optimization.

These are called sibling calls, and you can turn the optimization off
using -fno-optimize-sibling-calls.

(I wouldn't be surprised if you run into other problems with your
approach, but that switch should take care of that particular


More information about the Gcc-help mailing list