www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 5624] New: std.conv unittest disabled

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=5624

           Summary: std.conv unittest disabled
           Product: D
           Version: D2
          Platform: x86_64
        OS/Version: Linux
            Status: NEW
          Severity: critical
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: braddr puremagic.com



---
the debug version passes
the release version segvs

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Feb 20 2011
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=5624




---
reduced case.  Requires -m64 and -O.  Without -O it passes:

module bug;

extern(C) int printf(const char*, ...);

wstring toImpl(int value)
{
    wchar[13] buffer;

    auto u = -cast(int) value;
    uint ndigits = 1;
    while (u)
    {  
        immutable c = cast(char)((u % 10) + '0');
        u /= 10;
        buffer[$ - ndigits] = c;
        ++ndigits;
    }
    assert(ndigits <= buffer.length);
    buffer[$ - ndigits] = '-';
    //printf("ndigits = %d, buffer.length = %zd, diff = %d\n", ndigits,
buffer.length, buffer.length - ndigits);
    return cast(wstring) buffer[buffer.length - ndigits .. buffer.length].dup;
}

int main()
{
    wstring s = toImpl(int.min);
    return 0;
}

Uncommenting the printf results in:
    Illegal instruction

from objdump --disassemble:
  fe:   66 48 c7 06 2d 00 48    data32 movq $0xffffffff8948002d,(%rsi)
 105:   89 
 106:   d9 48 ba                (bad)  -0x46(%rax)
 109:   0d 00 00 00 00          or     $0x0,%eax

from obj2asm:

00fe:   66 48 C7 06 2D 00       mov     qword ptr [RSI],02Dh
0104:   48 89 D9                mov     RCX,RBX
0107:   48 BA 0D 00 00 00 00 00 00 00   mov     RDX,0Dh
0111:   48 89 75 D0             mov     -030h[RBP],RSI

0x2d == '-'.  This is part of the buffer[$ - ndigits] = '-' line.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
May 01 2011
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=5624


Brad Roberts <braddr puremagic.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED


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