------- Comment #3 from jakub at gcc dot gnu dot org 2008-11-07 16:19 ------- In assembly, it seems the a and b arguments to mymemcmp1 aren't stored into memory at all: .loc 1 128 0 movq (%rax), %r12 #* srcp2.272, b0 .LVL54: .loc 1 126 0 movq (%rdi), %rsi #* srcp1, a3 .LVL55: .loc 1 127 0 movq 8(%rdi), %rbx #, a0 .LVL56: .loc 1 129 0 addq $8, %rdi #, srcp1.270 .LVL57: .L28: .loc 1 152 0 movl %r9d, %ecx #, .LVL58: movq %rbx, %r10 # a0, tmp154 .loc 1 149 0 movq 8(%rdi), %r11 #, a1 .LVL59: .loc 1 152 0 salq %cl, %r10 #, tmp154 movl %r8d, %ecx #, .loc 1 150 0 movq 8(%rax), %rbp #, b1 .LVL60: .loc 1 152 0 shrq %cl, %rsi #, tmp155 .LVL61: orq %rsi, %r10 # tmp155, tmp156 cmpq %r12, %r10 # b0, tmp156 je .L26 #, .LBB112: .LBB113: .loc 1 8 0 leaq -8(%rsp), %rcx #, srcp1 .LVL62: .loc 1 9 0 leaq -16(%rsp), %rdx #, srcp2 .LVL63: .p2align 4,,10 .p2align 3 .L31: .loc 1 13 0 movzbl (%rcx), %eax #* srcp1, a0 .LVL64: .loc 1 14 0 movzbl (%rdx), %edi #* srcp2, b0 ...
At je .L26 insn %r12 register contains correct value of b0 variable and %r10 of x (shifted + ored together value). But then suddenly the code assumes it is in memory without actually storing it there. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38051