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: nob...@puremagic.com Reporter: john.loughran.col...@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: * thread #1: tid = 0xbb145, 0x000000010014fbcd dmd`Port::readlongLE(void*) + 5, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x3) frame #0: 0x000000010014fbcd dmd`Port::readlongLE(void*) + 5 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 * thread #1: tid = 0xbb145, 0x000000010014fbcd dmd`Port::readlongLE(void*) + 5, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x3) * frame #0: 0x000000010014fbcd dmd`Port::readlongLE(void*) + 5 frame #1: 0x000000010012f6bf dmd`D4ddmd7libmach7LibMach9addObjectMFPxaxAhZv + 1223 frame #2: 0x00000001000db7ed dmd`D4ddmd4mars7tryMainFmPPxaZi + 14205 frame #3: 0x00000001000030e3 dmd`_Dmain + 39 frame #4: 0x000000010023e260 dmd`D2rt6dmain211_d_run_mainUiPPaPUAAaZiZ6runAllMFZ9__lambda1MFZv + 40 frame #5: 0x000000010023e194 dmd`D2rt6dmain211_d_run_mainUiPPaPUAAaZiZ7tryExecMFMDFZvZv + 36 frame #6: 0x000000010023e205 dmd`D2rt6dmain211_d_run_mainUiPPaPUAAaZiZ6runAllMFZv + 45 frame #7: 0x000000010023e194 dmd`D2rt6dmain211_d_run_mainUiPPaPUAAaZiZ7tryExecMFMDFZvZv + 36 frame #8: 0x000000010023e0fa dmd`_d_run_main + 498 frame #9: 0x000000010000317c dmd`main + 16 frame #10: 0x0000000100001724 dmd`start + 52 (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) --