www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 16543] New: dmd segfaults when given elf lib on os x

https://issues.dlang.org/show_bug.cgi?id=16543

          Issue ID: 16543
           Summary: dmd segfaults when given elf lib on os x
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Mac OS X
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: john.loughran.colvin gmail.com

Created attachment 1616
  --> https://issues.dlang.org/attachment.cgi?id=1616&action=edit
the offending elf archive

The attached ELF archive file causes dmd to segfault on OS X if you run this:

dmd -lib liblzf.a

Here's backtrace and disassembly:


queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1,
address=0x3)

dmd`Port::readlongLE:
->  0x10014fbcd <+5>:  movzbl 0x3(%rdi), %eax
    0x10014fbd1 <+9>:  shll   $0x8, %eax
    0x10014fbd4 <+12>: movzbl 0x2(%rdi), %ecx
    0x10014fbd8 <+16>: orl    %ecx, %eax

(lldb) bt all

queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1,
address=0x3)


+ 1223



dmd`D2rt6dmain211_d_run_mainUiPPaPUAAaZiZ6runAllMFZ9__lambda1MFZv + 40

dmd`D2rt6dmain211_d_run_mainUiPPaPUAAaZiZ7tryExecMFMDFZvZv + 36

dmd`D2rt6dmain211_d_run_mainUiPPaPUAAaZiZ6runAllMFZv + 45

dmd`D2rt6dmain211_d_run_mainUiPPaPUAAaZiZ7tryExecMFMDFZvZv + 36



(lldb) disas
dmd`Port::readlongLE:
    0x10014fbc8 <+0>:  pushq  %rbp
    0x10014fbc9 <+1>:  movq   %rsp, %rbp
    0x10014fbcc <+4>:  pushq  %rbx
->  0x10014fbcd <+5>:  movzbl 0x3(%rdi), %eax
    0x10014fbd1 <+9>:  shll   $0x8, %eax
    0x10014fbd4 <+12>: movzbl 0x2(%rdi), %ecx
    0x10014fbd8 <+16>: orl    %ecx, %eax
    0x10014fbda <+18>: shll   $0x8, %eax
    0x10014fbdd <+21>: movzbl 0x1(%rdi), %edx
    0x10014fbe1 <+25>: orl    %edx, %eax
    0x10014fbe3 <+27>: shll   $0x8, %eax
    0x10014fbe6 <+30>: movzbl (%rdi), %ebx
    0x10014fbe9 <+33>: orl    %ebx, %eax
    0x10014fbeb <+35>: popq   %rbx
    0x10014fbec <+36>: popq   %rbp
    0x10014fbed <+37>: retq   
    0x10014fbee <+38>: nop    
(lldb)

--
Sep 25 2016