digitalmars.D.bugs - [Issue 8518] New: Segmentation fault in _memset128ii
- d-bugmail puremagic.com (32/32) Aug 07 2012 http://d.puremagic.com/issues/show_bug.cgi?id=8518
- d-bugmail puremagic.com (72/72) Feb 09 2013 http://d.puremagic.com/issues/show_bug.cgi?id=8518
http://d.puremagic.com/issues/show_bug.cgi?id=8518 Summary: Segmentation fault in _memset128ii Product: D Version: D2 Platform: x86_64 OS/Version: Linux Status: NEW Severity: major Priority: P2 Component: DMD AssignedTo: nobody puremagic.com ReportedBy: jerro.public gmail.com The following program causes a segmentations fault when compiled with -O -inline -release with DMD 2.060 on 64 bit Linux: struct A { double a; double b; } void main() { auto a = new A[2]; a[] = A.init; } The core dump: Core was generated by `./f'. Program terminated with signal 11, Segmentation fault. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Aug 07 2012
http://d.puremagic.com/issues/show_bug.cgi?id=8518 hsteoh quickfur.ath.cx changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |hsteoh quickfur.ath.cx Hmm. Looks like this issue is related to bug 9449. Here's the disassembly of Dmain: 0000000000418bd0 <_Dmain>: 418bd0: 55 push %rbp 418bd1: 48 8b ec mov %rsp,%rbp 418bd4: 48 83 ec 30 sub $0x30,%rsp 418bd8: 48 be 02 00 00 00 00 movabs $0x2,%rsi 418bdf: 00 00 00 418be2: 48 bf f0 60 63 00 00 movabs $0x6360f0,%rdi 418be9: 00 00 00 418bec: e8 4f 19 00 00 callq 41a540 <_d_newarrayiT> 418bf1: 48 89 45 e0 mov %rax,-0x20(%rbp) 418bf5: 48 89 55 e8 mov %rdx,-0x18(%rbp) 418bf9: 48 8b 75 e0 mov -0x20(%rbp),%rsi 418bfd: f2 48 0f 10 05 3a 7d rex.W movsd 0x17d3a(%rip),%xmm0 est1A6__initZ+0x10> 418c04: 01 00 418c06: f2 48 0f 11 45 f0 rex.W movsd %xmm0,-0x10(%rbp) 418c0c: f2 48 0f 10 0d 2b 7d rex.W movsd 0x17d2b(%rip),%xmm1 est1A6__initZ+0x10> 418c13: 01 00 418c15: f2 48 0f 11 4d f8 rex.W movsd %xmm1,-0x8(%rbp) 418c1b: dd 45 f0 fldl -0x10(%rbp) 418c1e: dd 45 f8 fldl -0x8(%rbp) 418c21: dd 5d d0 fstpl -0x30(%rbp) 418c24: f2 0f 10 4d d0 movsd -0x30(%rbp),%xmm1 418c29: dd 5d d0 fstpl -0x30(%rbp) 418c2c: f2 0f 10 45 d0 movsd -0x30(%rbp),%xmm0 418c31: 48 89 d7 mov %rdx,%rdi 418c34: e8 7f 1d 00 00 callq 41a9b8 <_memset128ii> 418c39: 31 c0 xor %eax,%eax 418c3b: c9 leaveq 418c3c: c3 retq Here's the disassembly of _memset128ii: 000000000041a9b8 <_memset128ii>: 41a9b8: 55 push %rbp 41a9b9: 48 8b ec mov %rsp,%rbp 41a9bc: 48 83 ec 20 sub $0x20,%rsp 41a9c0: 48 89 75 e8 mov %rsi,-0x18(%rbp) 41a9c4: 48 89 55 f0 mov %rdx,-0x10(%rbp) 41a9c8: 49 89 f8 mov %rdi,%r8 41a9cb: 49 89 fb mov %rdi,%r11 41a9ce: 49 89 c9 mov %rcx,%r9 41a9d1: 49 c1 e1 04 shl $0x4,%r9 41a9d5: 4c 03 cf add %rdi,%r9 41a9d8: 4d 3b c1 cmp %r9,%r8 41a9db: 73 18 jae 41a9f5 <_memset128ii+0x3d> 41a9dd: 48 8b 55 f0 mov -0x10(%rbp),%rdx 41a9e1: 48 8b 45 e8 mov -0x18(%rbp),%rax 41a9e5: 49 89 00 mov %rax,(%r8) 41a9e8: 49 89 50 08 mov %rdx,0x8(%r8) 41a9ec: 49 83 c0 10 add $0x10,%r8 41a9f0: 4d 39 c8 cmp %r9,%r8 41a9f3: 72 e8 jb 41a9dd <_memset128ii+0x25> 41a9f5: 49 8b c3 mov %r11,%rax 41a9f8: 48 8b e5 mov %rbp,%rsp 41a9fb: 5d pop %rbp 41a9fc: c3 retq Notice the Dmain fails to pass the expected parameters to _memset128ii, which expects %rcx to be the count, %rdx to be the .ptr value of the array, but Dmain does not set these registers, so they have garbage values. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Feb 09 2013