All of lore.kernel.org
 help / color / mirror / Atom feed
From: Markus Trippelsdorf <markus@trippelsdorf.de>
To: Antoine Pelisse <apelisse@gmail.com>
Cc: git <git@vger.kernel.org>
Subject: Re: git-blame segfault
Date: Tue, 3 Dec 2013 09:45:40 +0100	[thread overview]
Message-ID: <20131203084540.GA276@x4> (raw)
In-Reply-To: <20131202150541.GB275@x4>

On 2013.12.02 at 16:05 +0100, Markus Trippelsdorf wrote:
> On 2013.12.02 at 15:15 +0100, Antoine Pelisse wrote:
> > Would that mean that gcc is doing some steps in the wrong order ? That
> > is setting xecfg.hunk_func and then emptying the structure ? I've
> > already had a similar bug, but that's very unfortunate.
> 
> Yes. I think this might be the case:
> 
> (gdb) disass
> Dump of assembler code for function diff_hunks:
>    0x0000000000410460 <+0>:     sub    $0x58,%rsp
>    0x0000000000410464 <+4>:     xor    %eax,%eax
>    0x0000000000410466 <+6>:     mov    %eax,%r9d
>    0x0000000000410469 <+9>:     add    $0x20,%eax
>    0x000000000041046c <+12>:    cmp    $0x20,%eax
>    0x000000000041046f <+15>:    movq   $0x0,0x20(%rsp,%r9,1)
>    0x0000000000410478 <+24>:    movq   $0x0,0x28(%rsp,%r9,1)
>    0x0000000000410481 <+33>:    movq   $0x0,0x30(%rsp,%r9,1)
>    0x000000000041048a <+42>:    movq   $0x0,0x38(%rsp,%r9,1)
>    0x0000000000410493 <+51>:    jb     0x410466 <diff_hunks+6>
>    0x0000000000410495 <+53>:    lea    0x20(%rsp),%r10
>    0x000000000041049a <+58>:    mov    %rdx,0x20(%rsp)
>    0x000000000041049f <+63>:    mov    %rcx,0x48(%rsp)
>    0x00000000004104a4 <+68>:    add    %r10,%rax
>    0x00000000004104a7 <+71>:    mov    %r8,0x10(%rsp)
>    0x00000000004104ac <+76>:    mov    %rsp,%rdx
>    0x00000000004104af <+79>:    movq   $0x0,(%rax)
>    0x00000000004104b6 <+86>:    movq   $0x0,0x8(%rax)
>    0x00000000004104be <+94>:    lea    0x10(%rsp),%r8
>    0x00000000004104c3 <+99>:    movslq 0x171882(%rip),%rax        # 0x581d4c <xdl_opts>
>    0x00000000004104ca <+106>:   mov    %r10,%rcx
>    0x00000000004104cd <+109>:   movq   $0x0,0x18(%rsp)
>    0x00000000004104d6 <+118>:   mov    %rax,(%rsp)
>    0x00000000004104da <+122>:   callq  0x50aee0 <xdi_diff>
> => 0x00000000004104df <+127>:   add    $0x58,%rsp
>    0x00000000004104e3 <+131>:   retq   
> End of assembler dump.

Should be fixed in gcc soon. For the curious, here is the assembler diff
(bad vs. good):

        .type   diff_hunks, @function
 diff_hunks:
 .LFB104:
        .cfi_startproc
        subq    $88, %rsp
        .cfi_def_cfa_offset 96
        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
        movq    %r8, 16(%rsp)
+       addq    %r10, %rax
+       leaq    16(%rsp), %r8
        movq    %rsp, %rdx
-       movq    $0, (%rax)
        movq    $0, 8(%rax)
-       leaq    16(%rsp), %r8
+       movq    $0, (%rax)
        movslq  xdl_opts(%rip), %rax
+       movq    %rcx, 72(%rsp)
        movq    %r10, %rcx
        movq    $0, 24(%rsp)
        movq    %rax, (%rsp)
        call    xdi_diff
        addq    $88, %rsp
        .cfi_def_cfa_offset 8

-- 
Markus

  reply	other threads:[~2013-12-03  8:45 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-12-02 12:57 git-blame segfault Markus Trippelsdorf
2013-12-02 14:15 ` Antoine Pelisse
2013-12-02 15:05   ` Markus Trippelsdorf
2013-12-03  8:45     ` Markus Trippelsdorf [this message]
2013-12-03  9:04       ` Antoine Pelisse

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20131203084540.GA276@x4 \
    --to=markus@trippelsdorf.de \
    --cc=apelisse@gmail.com \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.