------- Comment #19 from tege-gcc at swox dot com 2008-02-24 20:39 ------- I believe the "local call" optimization is triggered when compiling __gmp_randget_mt() because its only call is to a function the compiler determines to be local. (One can easily untrigger the optimization by inserting a dummy call to foo() in __gmp_mt_recalc_buffer().)
After all the [__gmp_mt_recalc_buffer()] function is global, not local, and can be overridden, so why would GCC assume that just because it knows its body it can ignore the usual alignment requirements for global functions? I think we're using "global" and "local" in two sense here. Sure, __gmp_mt_recalc_buffer() is global in visibility, but it is local to the compilation unit, which is what counts for the semi-invalid optimization discussed. GCC bases its decision whether to call with an unaligned stack solely on the latter definition of "local". -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35271