D - seven bugs in DMD 0.79
I report some bugs. if you understand this problems , neglect me , Mr.Walter. 1. GC disable/enable are not implemented. it needs to write in fullCollect() in gcx.d if (gcx.disabled > 0) return 0; 2. object.d(14): alias size_t conflicts with time.size_t at std\c\time.d(10) eg. import std.c.time private import std.c.time; size_t a; // compile error 3.a bug in dchar decode(wchar[] s, inout uint idx) in std.utf.toUTF32 at std.utf.toUTF32(222) , ' else { i++; }' is needed. 4.private import in a class is not 'private'. eg. in std.stream.d(51) :class Stream { private import std.string, crc32, std.c.stdlib, std.c.stdio;We can access std.c.stdlib via Stream. 5. I've examined the bug about : http://www.digitalmars.com/drn-bin/wwwnews?D/22628 http://www.digitalmars.com/drn-bin/wwwnews?D/21999 the access violation code is : 004042B8 |. FF50 14 CALL DWORD PTR DS:[EAX+14] (where EAX = 409f88 , [EAX+14] = e8004996) the call stack : ESP ==> > 004042BB RETURN to dmd.004042BB ESP+4 > 003AAC90 ASCII "x€I" ESP+8 > 003AB444 ESP+C > 003AE770 ESP+10 > 003AE770 ESP+14 > 00403FB6 RETURN to dmd.00403FB6 from dmd.004042AC I guess the address is DsymbolTable::lookup in dsymbol.c(519)sv = tab->lookup(ident->toChars(),strlen(ident->toChars()));ident->toChars() makes access violation when 'ident' is something wrong , for example , a struct name is the same as a module name. 6.pre-declaration of class makes compiler crash. eg. class foo; I've tested in WindowsXP. perhaps , 6. is the same cause as 5. 7.a variable use in naked function class Test { void test(){ m = 1; asm { naked; ret; } } int m; void print() { printf("%d\n",m); } } int main() { Test t = new Test; t.test(); t.print(); return 0; } result : 0 ( I assume it should be 1.) (compile with -debug option) compiler generates the following code :mov [EAX + 8], 1 retI assume the next code would be right when compile with -debug option. push EAX; mov [EAX + 8],1 pop EAX ret yaneurao.
Jan 28 2004
compiler generates the following code :??? >8-/ There is no need to preserve EAX around this "mov", since it does not modify any register.mov [EAX + 8], 1 retI assume the next code would be right when compile with -debug option. push EAX; mov [EAX + 8],1 pop EAX ret
Jan 28 2004
In article <bv9st6$2no5$1 digitaldaemon.com>, Serge K says...sorry for my bad explanation. compiler generates , mov EAX,[EBP+4] mov [EAX + 8], 1 ret compiler assumes that [EBP+4] is 'this' pointer , but it doesn't so in a naked function compiled with -debug option. and EAX is 'this' pointer by chance in a naked function. therefore , it doesn't need to generate mov EAX,[EBP+4] , or it is better to preserve EAX to access member variables. yaneurao.I assume the next code would be right when compile with -debug option. push EAX; mov [EAX + 8],1 pop EAX ret??? >8-/ There is no need to preserve EAX around this "mov", since it does not modify any register.
Jan 29 2004
"yaneurao" <yaneurao_member pathlink.com> wrote in message news:bvap19$15qi$1 digitaldaemon.com...In article <bv9st6$2no5$1 digitaldaemon.com>, Serge K says...modify any register.I assume the next code would be right when compile with -debug option. push EAX; mov [EAX + 8],1 pop EAX ret??? >8-/ There is no need to preserve EAX around this "mov", since it does notsorry for my bad explanation. compiler generates , mov EAX,[EBP+4] mov [EAX + 8], 1 ret compiler assumes that [EBP+4] is 'this' pointer , but it doesn't so in a naked function compiled with -debug option. and EAX is 'this' pointer by chance in a naked function. therefore , it doesn't need to generate mov EAX,[EBP+4] , or it is better to preserve EAX to access member variables. yaneurao.Not -debug. -g is right. See http://www.digitalmars.com/drn-bin/wwwnews?D/20418
Jan 29 2004
"yaneurao" <yaneurao_member pathlink.com> wrote in message news:bvap19$15qi$1 digitaldaemon.com...In article <bv9st6$2no5$1 digitaldaemon.com>, Serge K says...modify any register.I assume the next code would be right when compile with -debug option. push EAX; mov [EAX + 8],1 pop EAX ret??? >8-/ There is no need to preserve EAX around this "mov", since it does notsorry for my bad explanation. compiler generates , mov EAX,[EBP+4] mov [EAX + 8], 1 ret compiler assumes that [EBP+4] is 'this' pointer , but it doesn't so in a naked function compiled with -debug option. and EAX is 'this' pointer by chance in a naked function. therefore , it doesn't need to generate mov EAX,[EBP+4] , or it is better to preserve EAX to access member variables.With a 'naked' function, the programmer must set up the stack frame, as the 'naked' tells the code generator to not do it automatically. Realistically, with 'naked' functions, you should write the entire function in assembler. In other words, this is working as intended.
Jan 29 2004
In article <bvbmn8$2nld$1 digitaldaemon.com>, Walter says...With a 'naked' function, the programmer must set up the stack frame, as the 'naked' tells the code generator to not do it automatically. Realistically, with 'naked' functions, you should write the entire function in assembler.I agree. I think it is better to transcribe it. yaneurao.
Jan 29 2004
Good reports. On a side note the new .79 has broken my code , and I finnaly ran into the dreaded import trouble. How does changing from module level imports to class level fix this , and why is this a problem ? Also we should warn new users of it. C "yaneurao" <yaneurao_member pathlink.com> wrote in message news:bv9gf2$24bl$1 digitaldaemon.com...I report some bugs. if you understand this problems , neglect me , Mr.Walter. 1. GC disable/enable are not implemented. it needs to write in fullCollect() in gcx.d if (gcx.disabled > 0) return 0; 2. object.d(14): alias size_t conflicts with time.size_t atstd\c\time.d(10)eg. import std.c.time private import std.c.time; size_t a; // compile error 3.a bug in dchar decode(wchar[] s, inout uint idx) in std.utf.toUTF32 at std.utf.toUTF32(222) , ' else { i++; }' is needed. 4.private import in a class is not 'private'. eg. in std.stream.d(51) :class Stream { private import std.string, crc32, std.c.stdlib, std.c.stdio;We can access std.c.stdlib via Stream. 5. I've examined the bug about : http://www.digitalmars.com/drn-bin/wwwnews?D/22628 http://www.digitalmars.com/drn-bin/wwwnews?D/21999 the access violation code is : 004042B8 |. FF50 14 CALL DWORD PTR DS:[EAX+14] (where EAX = 409f88 , [EAX+14] = e8004996) the call stack : ESP ==> > 004042BB RETURN to dmd.004042BB ESP+4 > 003AAC90 ASCII "x?I" ESP+8 > 003AB444 ESP+C > 003AE770 ESP+10 > 003AE770 ESP+14 > 00403FB6 RETURN to dmd.00403FB6 from dmd.004042AC I guess the address is DsymbolTable::lookup in dsymbol.c(519)sv = tab->lookup(ident->toChars(),strlen(ident->toChars()));ident->toChars() makes access violation when 'ident' is something wrong , for example , a struct name is the same as a module name. 6.pre-declaration of class makes compiler crash. eg. class foo; I've tested in WindowsXP. perhaps , 6. is the same cause as 5. 7.a variable use in naked function class Test { void test(){ m = 1; asm { naked; ret; } } int m; void print() { printf("%d\n",m); } } int main() { Test t = new Test; t.test(); t.print(); return 0; } result : 0 ( I assume it should be 1.) (compile with -debug option) compiler generates the following code :mov [EAX + 8], 1 retI assume the next code would be right when compile with -debug option. push EAX; mov [EAX + 8],1 pop EAX ret yaneurao.
Jan 29 2004