This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug target/59363] [4.9 Regression] r203886 miscompiles git


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59363

--- Comment #2 from Markus Trippelsdorf <octoploid at yandex dot com> ---

22209 static int diff_hunks(mmfile_t *file_a, mmfile_t *file_b, long ctxlen,
22210         xdl_emit_hunk_consume_func_t hunk_func, void *cb_data)
22211 {
22212  xpparam_t xpp = {0};
22213  xdemitconf_t xecfg = {0};
22214  xdemitcb_t ecb = {((void *)0)};
22215
22216  xpp.flags = xdl_opts;
22217  xecfg.ctxlen = ctxlen;
22218  xecfg.hunk_func = hunk_func;
22219  ecb.priv = cb_data;
22220  return xdi_diff(file_a, file_b, &xpp, &xecfg, &ecb);
22221 }
22222

"xdemitconf_t xecfg = {0};" is the problematic line.
If I leave the variable uninitialized the issue goes away.

The difference of:
cc -S -c -O2 -march=native blame.i
cc -S -c -O2 blame.i

@@ -256,38 +256,36 @@
 .LCOLDB5:
        .text
 .LHOTB5:
-       .p2align 5,,31
+       .p2align 4,,15
        .type   diff_hunks, @function
 diff_hunks:
 .LFB104:
        .cfi_startproc
-       subq    $88, %rsp
-       .cfi_def_cfa_offset 96
+       pushq   %rbx
+       .cfi_def_cfa_offset 16
+       .cfi_offset 3, -16
+       movq    %rdi, %r11
+       movq    %rcx, %rbx
        xorl    %eax, %eax
-.L31:
-       movl    %eax, %r9d
-       addl    $32, %eax
-       cmpl    $32, %eax
-       movq    $0, 32(%rsp,%r9)
-       movq    $0, 40(%rsp,%r9)
-       movq    $0, 48(%rsp,%r9)
-       movq    $0, 56(%rsp,%r9)
-       jb      .L31
-       leaq    32(%rsp), %r10
-       movq    %rdx, 32(%rsp)
-       movq    %rcx, 72(%rsp)
-       addq    %r10, %rax
+       movl    $6, %ecx
+       subq    $80, %rsp
+       .cfi_def_cfa_offset 96
+       leaq    32(%rsp), %rdi
        movq    %r8, 16(%rsp)
-       movq    %rsp, %rdx
-       movq    $0, (%rax)
-       movq    $0, 8(%rax)
        leaq    16(%rsp), %r8
-       movslq  xdl_opts(%rip), %rax
-       movq    %r10, %rcx
        movq    $0, 24(%rsp)
+       rep stosq
+       movslq  xdl_opts(%rip), %rax
+       leaq    32(%rsp), %rcx
+       movq    %rdx, 32(%rsp)
+       movq    %r11, %rdi
+       movq    %rsp, %rdx
+       movq    %rbx, 72(%rsp)
        movq    %rax, (%rsp)
        call    xdi_diff
-       addq    $88, %rsp
+       addq    $80, %rsp
+       .cfi_def_cfa_offset 16
+       popq    %rbx
        .cfi_def_cfa_offset 8
        ret
        .cfi_endproc


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]