Bug from cpuid wrapper thread in D.announce: char[12] str = "";
notknown
notknown at none.com
Thu Oct 26 02:37:57 PDT 2006
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.
More information about the Digitalmars-d-bugs
mailing list