http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55498
--- Comment #3 from Matt Hargett <matt at use dot net> 2013-02-11 02:11:36 UTC --- Just tested with latest trunk and things have regressed/changed a bit. This is another test case where I *have* to use both -O3 and -funroll-loops to get the desired effect. This didn't use to be the case. Also, even at -O3 the indirect references to one() and two() are inlined, but the actual immediates returned by those functions is not. #include <stdio.h> typedef unsigned char(*Calculable)(void); typedef Calculable(*CalculateStrategy)(void); unsigned char one() { return 1; } Calculable oneStrategy() { return one; } unsigned char two() { return 2; } Calculable twoStrategy() { return two; } static void print(CalculateStrategy calculateStrategy) { printf("%d\n", calculateStrategy()()); printf("+1: %d\n", calculateStrategy()() + 1); } int main() { for (int i = 3; i > 0; i--) { print(oneStrategy); print(twoStrategy); } return 0; }