September 03, 2005
Using DMD 0.129, Windows 98SE.

I've spent hours isolating this bug, which is holding back the Indigo project.  IPF every time.  To see it, you must compile the modules together in one DMD invocation (doesn't matter whether you use -c or not).

----- locale.d -----
module locale;

import vector;

void ulongToString() {
Vector!(wchar) result;
}
----- vector.d -----
module vector;

template DataStreamability()
{
const int isStreamable = true;

void read(int st, int val)
{
st >>= val;
}
}

struct Vector(T)
{
static if (DataStreamability!().isStreamable) { }
}
----------
DMD caused an invalid page fault in
module DMD.EXE at 0167:004428b1.
Registers:
EAX=0071fca4 CS=0167 EIP=004428b1 EFLGS=00010202
EBX=004af640 SS=016f ESP=0071fbfc EBP=0071fc14
ECX=00000000 DS=016f ESI=00888e10 FS=13cf
EDX=0071fd18 ES=016f EDI=0088b8b4 GS=0000
Bytes at CS:EIP:
8b 01 ff 90 a8 00 00 00 89 45 fc ff 75 08 8b 55
Stack dump:
0088b8b4 00888e10 004af640 00882a58 0071fc44 004482a4 0071fc38 004442ca
0071fca4 0000003c 0043e919 0071fca4 00888e10 004b68a4 0071fd18 0071fc5c
----------

It doesn't seem to matter what operator is used in read, as long as it involves both arguments.  Indigo itself uses >> here (and parameter types on which such an expression actually does something).

Stewart.


September 04, 2005
Stewart Gordon schrieb:

> Using DMD 0.129, Windows 98SE.
> 
> I've spent hours isolating this bug, which is holding back the Indigo project.  IPF every time.  To see it, you must compile the modules together in one DMD invocation (doesn't matter whether you use -c or not).
> 
> ----- locale.d -----
> module locale;
> 
> import vector;
> 
> void ulongToString() {
> Vector!(wchar) result;
> }
> ----- vector.d -----
> module vector;
> 
> template DataStreamability()
> {
> const int isStreamable = true;
> 
> void read(int st, int val)
> {
> st >>= val;
> }
> }
> 
> struct Vector(T)
> {
> static if (DataStreamability!().isStreamable) { }
> }
> ----------
> DMD caused an invalid page fault in
> module DMD.EXE at 0167:004428b1.
> Registers:
> EAX=0071fca4 CS=0167 EIP=004428b1 EFLGS=00010202
> EBX=004af640 SS=016f ESP=0071fbfc EBP=0071fc14
> ECX=00000000 DS=016f ESI=00888e10 FS=13cf
> EDX=0071fd18 ES=016f EDI=0088b8b4 GS=0000
> Bytes at CS:EIP:
> 8b 01 ff 90 a8 00 00 00 89 45 fc ff 75 08 8b 55
> Stack dump:
> 0088b8b4 00888e10 004af640 00882a58 0071fc44 004482a4 0071fc38 004442ca
> 0071fca4 0000003c 0043e919 0071fca4 00888e10 004b68a4 0071fd18 0071fc5c
> ----------
> 
> It doesn't seem to matter what operator is used in read, as long as it involves both arguments.  Indigo itself uses >> here (and parameter types on which such an expression actually does something).

segfault:
dmd vector.d locale.d

no segfault:
dmd locale.d vector.d

Program received signal SIGSEGV, Segmentation fault.
0x0808861f in BinExp::toElemBin(IRState*, int) ()
(gdb) bt
#0  0x0808861f in BinExp::toElemBin(IRState*, int) ()
#1  0x08089f3b in ShrAssignExp::toElem(IRState*) ()
#2  0x080d318d in ExpStatement::toIR(IRState*) ()
#3  0x080d31d2 in CompoundStatement::toIR(IRState*) ()
#4  0x080ac907 in FuncDeclaration::toObjFile() ()
#5  0x080ddd12 in TemplateInstance::toObjFile() ()
#6  0x080ac2c5 in Module::genobjfile() ()
#7  0x080ba98f in main ()
#8  0x400f2c57 in __libc_start_main () from /lib/i686/libc.so.6

Added to DStress as http://dstress.kuehne.cn/compile/b/bug_20050903_A.d http://dstress.kuehne.cn/compile/b/bug_20050903_B.d

Thomas