http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50182
--- Comment #36 from oleg at smolsky dot net 2012-03-03 02:59:11 UTC --- Here is the code emitted by g++ 4.6.3 for smaller_test.cpp (attached to the bug) unsigned int test_constant<> proc near mov r9d, cs:iterations xor r8d, r8d xor eax, eax test r9d, r9d jle short locret_400552 db 66h, 66h, 66h nop db 66h, 66h nop loc_400528: xor ecx, ecx xor edx, edx test esi, esi jle short loc_40054E loc_400530: add edx, 0Ah add dl, [rdi+rcx] add rcx, 1 cmp esi, ecx jg short loc_400530 movsx edx, dl loc_400541: add r8d, 1 add eax, edx cmp r8d, r9d jnz short loc_400528 rep retn loc_40054E: xor edx, edx jmp short loc_400541 locret_400552: rep retn