www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - Bug from cpuid wrapper thread in D.announce: char[12] str = "";

reply notknown <notknown none.com> writes:
 From the cpuid wrapper thread in D.annoucments.

Tomas Lindquist Olsen:
 Do you think you could narrow this down? Seems it's not happening for
 Windows users. Might as well report it if it's a real bug.

 Basically some testing of class member initialisers.
Okay, I narrowed it down as much as I could to this little test. bug.d: [code] module bug; import std.stdio; class Bug { char[12] str = ""; uint t = 1; } class NoBug { uint t = 1; char[12] str = ""; } class NoBug2 { char[12] str; uint t = 1; } void main() { auto b = new Bug; auto n = new NoBug; auto n2 = new NoBug2; writefln("bug %d", b.t); writefln("nobug %d", n.t); writefln("nobug2 %d", n2.t); } [/code] $dmd -w bug.d gcc bug.o -o bug -m32 -lphobos -lpthread -lm $./bug.d bug 0 nobug 1 nobug2 1 Digital Mars D Compiler v0.172 I run on Ubuntu Kernel 2.6.15-27-k7 Hope that helps.
Oct 26 2006
parent Thomas Kuehne <thomas-dloop kuehne.cn> writes:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

notknown schrieb am 2006-10-26:
  From the cpuid wrapper thread in D.annoucments.

 Tomas Lindquist Olsen:
 Do you think you could narrow this down? Seems it's not happening for
 Windows users. Might as well report it if it's a real bug.

 Basically some testing of class member initialisers.
Okay, I narrowed it down as much as I could to this little test. bug.d: [code] module bug; import std.stdio; class Bug { char[12] str = ""; uint t = 1; } class NoBug { uint t = 1; char[12] str = ""; } class NoBug2 { char[12] str; uint t = 1; } void main() { auto b = new Bug; auto n = new NoBug; auto n2 = new NoBug2; writefln("bug %d", b.t); writefln("nobug %d", n.t); writefln("nobug2 %d", n2.t); } [/code] $dmd -w bug.d gcc bug.o -o bug -m32 -lphobos -lpthread -lm $./bug.d bug 0 nobug 1 nobug2 1 Digital Mars D Compiler v0.172 I run on Ubuntu Kernel 2.6.15-27-k7 Hope that helps.
Added to DStress as http://dstress.kuehne.cn/run/o/odd_bug_10_A.d http://dstress.kuehne.cn/run/o/odd_bug_10_B.d http://dstress.kuehne.cn/run/o/odd_bug_10_C.d Thomas -----BEGIN PGP SIGNATURE----- iD8DBQFFZXhALK5blCcjpWoRAn52AKCWSIjNSw8Eig1lplvX2DF+Mql4vgCgrb3L SCU8YQ4mw1PufZ7KTxYM2tY= =iQQz -----END PGP SIGNATURE-----
Nov 23 2006