https://gcc.gnu.org/bugzilla/show_bug.cgi?id=58066

--- Comment #14 from Uroš Bizjak <ubizjak at gmail dot com> ---
(In reply to Uroš Bizjak from comment #13)

> Patch in testing.

This patch fixes the testcase, now we get:

0000000000000000 <inet_ntoa>:
   0:   41 56                   push   %r14
   2:   41 55                   push   %r13
   4:   44 0f b6 ef             movzbl %dil,%r13d
   8:   41 54                   push   %r12
   a:   55                      push   %rbp
   b:   41 89 fc                mov    %edi,%r12d
   e:   53                      push   %rbx
   f:   89 fb                   mov    %edi,%ebx
  11:   41 c1 ec 10             shr    $0x10,%r12d
  15:   0f b6 c7                movzbl %bh,%eax
  18:   c1 eb 18                shr    $0x18,%ebx
  1b:   45 0f b6 e4             movzbl %r12b,%r12d
  1f:   41 89 c6                mov    %eax,%r14d
  22:   48 8d 3d 00 00 00 00    lea    0(%rip),%rdi        # 29
<inet_ntoa+0x29>
                        25: R_X86_64_TLSLD      buffer+0xfffffffffffffffc
  29:   e8 00 00 00 00          callq  2e <inet_ntoa+0x2e>
                        2a: R_X86_64_PLT32     
__tls_get_addr+0xfffffffffffffffc
  2e:   48 83 ec 08             sub    $0x8,%rsp
  32:   48 8d 15 00 00 00 00    lea    0(%rip),%rdx        # 39
<inet_ntoa+0x39>
                        35: R_X86_64_PC32       .LC0+0xfffffffffffffffc
  39:   45 89 e1                mov    %r12d,%r9d
  3c:   48 8d a8 00 00 00 00    lea    0x0(%rax),%rbp
                        3f: R_X86_64_DTPOFF32   buffer
  43:   53                      push   %rbx
  44:   45 89 f0                mov    %r14d,%r8d
  47:   44 89 e9                mov    %r13d,%ecx
  4a:   31 c0                   xor    %eax,%eax
  4c:   be 12 00 00 00          mov    $0x12,%esi
  51:   48 89 ef                mov    %rbp,%rdi
  54:   e8 00 00 00 00          callq  59 <inet_ntoa+0x59>
                        55: R_X86_64_PLT32      __snprintf+0xfffffffffffffffc
  59:   58                      pop    %rax
  5a:   48 89 e8                mov    %rbp,%rax
  5d:   5a                      pop    %rdx
  5e:   5b                      pop    %rbx
  5f:   5d                      pop    %rbp
  60:   41 5c                   pop    %r12
  62:   41 5d                   pop    %r13
  64:   41 5e                   pop    %r14
  66:   c3                      retq   

The difference between patched (+++) and unpatched (---) code is:

--- pr58066_.s  2015-07-13 11:58:23.000000000 +0200
+++ pr58066.s   2015-07-13 11:58:26.000000000 +0200
@@ -28,16 +28,16 @@
        movzbl  %bh, %eax
        shrl    $24, %ebx
        movzbl  %r12b, %r12d
-       subq    $8, %rsp
-.LCFI5:
        movl    %eax, %r14d
        leaq    buffer@tlsld(%rip), %rdi
        call    __tls_get_addr@PLT
-       pushq   %rbx
-.LCFI6:
+       subq    $8, %rsp
+.LCFI5:
        leaq    .LC0(%rip), %rdx
        movl    %r12d, %r9d
        leaq    buffer@dtpoff(%rax), %rbp
+       pushq   %rbx
+.LCFI6:
        movl    %r14d, %r8d
        movl    %r13d, %ecx
        xorl    %eax, %eax

HJ, can you please test the patch if it fixes your problem?

Reply via email to