[Issue 9449] Segmentation fault in main()

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri Feb 8 21:39:33 PST 2013


http://d.puremagic.com/issues/show_bug.cgi?id=9449


hsteoh at quickfur.ath.cx changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
          Component|druntime                    |DMD


--- Comment #2 from hsteoh at quickfur.ath.cx 2013-02-08 21:39:27 PST ---
Actually, this looks like a compiler bug. The ubyte16 alias translates to
__vector(ubyte[16]), which is a compiler built-in magic type.

Here's the disassembly of Dmain:

0000000000418620 <_Dmain>:
  418620:       55                      push   %rbp
  418621:       48 8b ec                mov    %rsp,%rbp
  418624:       48 83 ec 10             sub    $0x10,%rsp
  418628:       48 be 01 00 00 00 00    movabs $0x1,%rsi
  41862f:       00 00 00 
  418632:       66 0f 6f 05 e6 77 01    movdqa 0x177e6(%rip),%xmm0        #
42fe20 <_IO_stdin_used+0x10>
  418639:       00 
  41863a:       48 8d 7d f0             lea    -0x10(%rbp),%rdi
  41863e:       e8 a9 07 00 00          callq  418dec <_memset128ii>
  418643:       31 c0                   xor    %eax,%eax
  418645:       c9                      leaveq 
  418646:       c3                      retq   

Here's the disassembly of _memset128ii:

0000000000418dec <_memset128ii>:
  418dec:       55                      push   %rbp
  418ded:       48 8b ec                mov    %rsp,%rbp
  418df0:       48 83 ec 20             sub    $0x20,%rsp
  418df4:       48 89 75 e8             mov    %rsi,-0x18(%rbp)
  418df8:       48 89 55 f0             mov    %rdx,-0x10(%rbp)
  418dfc:       49 89 f8                mov    %rdi,%r8
  418dff:       49 89 fb                mov    %rdi,%r11
  418e02:       49 89 c9                mov    %rcx,%r9
  418e05:       49 c1 e1 04             shl    $0x4,%r9
  418e09:       4c 03 cf                add    %rdi,%r9
  418e0c:       4d 3b c1                cmp    %r9,%r8
  418e0f:       73 18                   jae    418e29 <_memset128ii+0x3d>
  418e11:       48 8b 55 f0             mov    -0x10(%rbp),%rdx
  418e15:       48 8b 45 e8             mov    -0x18(%rbp),%rax
  418e19:       49 89 00                mov    %rax,(%r8)
  418e1c:       49 89 50 08             mov    %rdx,0x8(%r8)
  418e20:       49 83 c0 10             add    $0x10,%r8
  418e24:       4d 39 c8                cmp    %r9,%r8
  418e27:       72 e8                   jb     418e11 <_memset128ii+0x25>
  418e29:       49 8b c3                mov    %r11,%rax
  418e2c:       48 8b e5                mov    %rbp,%rsp
  418e2f:       5d                      pop    %rbp
  418e30:       c3                      retq   

Note that the expected parameters to memset128ii appear to not be passed by
Dmain; I traced the execution into memset128ii and found that it was trying to
memset an unreasonably large range of memory (2e+15 bytes), probably because
the wrong arguments were passed to it.

Since the only druntime code involved is template wrapper around the compiler
magic type __vector, the fault must lie with the compiler SIMD intrinsics.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list