http://d.puremagic.com/issues/show_bug.cgi?id=5624
--- Comment #1 from Brad Roberts <bra...@puremagic.com> 2011-05-01 02:04:56 PDT --- 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: -------