It turns out there is one specific optimization to disable with gcc 4.7.x: -fno-ipa-sra So stacks-native.c can be compiled with -O2 -fno-ipa-sra. The reason I continued to have a problem even after -O0, as Oleg found out, is that testd0opt would link to my bad system-installed library rather than the new one in the current directory. *facepalm* On Fri, Oct 19, 2012 at 4:35 AM, Gabriel Kerneis wrote: > On Fri, Oct 19, 2012 at 02:20:56AM -0000, oleg@okmij.org wrote: > > I'll see if I could find a pragma or other way to disable undesirable > > optimizations. > > No tested, but you could try -fno-optimize-sibling-calls: > $ gcc --help=optimizers|grep "tail recursive" > -foptimize-sibling-calls Optimize sibling and tail recursive calls > > Best, > -- > Gabriel >