www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - array assign bug

reply Kevin Watters <Kevin_member pathlink.com> writes:
struct Thing {
int[5] vals = 3;
}

void main() {
Thing t, g;

printf("%d %d\n", t.vals[0], g.vals[0]);
}

I get this output: 3 622879781

Is the compiler missing the array assignment on the second struct
initialization?
Feb 03 2006
parent reply Chris <Chris_member pathlink.com> writes:
In article <ds14nl$16h7$1 digitaldaemon.com>, Kevin Watters says...
struct Thing {
int[5] vals = 3;
}

void main() {
Thing t, g;

printf("%d %d\n", t.vals[0], g.vals[0]);
}

I get this output: 3 622879781

Is the compiler missing the array assignment on the second struct
initialization?
my output: 3 3 perhaps you aren't using the newest version of dmd.exe?
Feb 03 2006
parent reply Kevin Watters <Kevin_member pathlink.com> writes:
Definitely using 0.145, with Ares though--but I'm sure that wouldn't be the
problem. I ran into it while crafting a template vector class.

Can anyone else reproduce this?

In article <ds1d21$1bml$1 digitaldaemon.com>, Chris says...
In article <ds14nl$16h7$1 digitaldaemon.com>, Kevin Watters says...
struct Thing {
int[5] vals = 3;
}

void main() {
Thing t, g;

printf("%d %d\n", t.vals[0], g.vals[0]);
}

I get this output: 3 622879781

Is the compiler missing the array assignment on the second struct
initialization?
my output: 3 3 perhaps you aren't using the newest version of dmd.exe?
Feb 03 2006
parent reply Dave <Dave_member pathlink.com> writes:
0.145 (phobos) on both Linux and Windows working Ok for me as well. Try  it with
phobos once just for kicks.

In article <ds1ijd$1efp$1 digitaldaemon.com>, Kevin Watters says...
Definitely using 0.145, with Ares though--but I'm sure that wouldn't be the
problem. I ran into it while crafting a template vector class.

Can anyone else reproduce this?

In article <ds1d21$1bml$1 digitaldaemon.com>, Chris says...
In article <ds14nl$16h7$1 digitaldaemon.com>, Kevin Watters says...
struct Thing {
int[5] vals = 3;
}

void main() {
Thing t, g;

printf("%d %d\n", t.vals[0], g.vals[0]);
}

I get this output: 3 622879781

Is the compiler missing the array assignment on the second struct
initialization?
my output: 3 3 perhaps you aren't using the newest version of dmd.exe?
Feb 04 2006
parent reply Kevin Watters <Kevin_member pathlink.com> writes:
OK it did work with Phobos.

So it's a definite bug in Ares. I'll post it in the dsource.org Ares form.

Thanks for the help.

In article <ds2dfh$23j1$1 digitaldaemon.com>, Dave says...
0.145 (phobos) on both Linux and Windows working Ok for me as well. Try  it with
phobos once just for kicks.

In article <ds1ijd$1efp$1 digitaldaemon.com>, Kevin Watters says...
Definitely using 0.145, with Ares though--but I'm sure that wouldn't be the
problem. I ran into it while crafting a template vector class.

Can anyone else reproduce this?

In article <ds1d21$1bml$1 digitaldaemon.com>, Chris says...
In article <ds14nl$16h7$1 digitaldaemon.com>, Kevin Watters says...
struct Thing {
int[5] vals = 3;
}

void main() {
Thing t, g;

printf("%d %d\n", t.vals[0], g.vals[0]);
}

I get this output: 3 622879781

Is the compiler missing the array assignment on the second struct
initialization?
my output: 3 3 perhaps you aren't using the newest version of dmd.exe?
Feb 04 2006
parent reply Sean Kelly <sean f4.ca> writes:
Crazy.  I'll look into it.

Sean

Kevin Watters wrote:
 OK it did work with Phobos.
 
 So it's a definite bug in Ares. I'll post it in the dsource.org Ares form.
 
 Thanks for the help.
 
 In article <ds2dfh$23j1$1 digitaldaemon.com>, Dave says...
 0.145 (phobos) on both Linux and Windows working Ok for me as well. Try  it
with
 phobos once just for kicks.

 In article <ds1ijd$1efp$1 digitaldaemon.com>, Kevin Watters says...
 Definitely using 0.145, with Ares though--but I'm sure that wouldn't be the
 problem. I ran into it while crafting a template vector class.

 Can anyone else reproduce this?

 In article <ds1d21$1bml$1 digitaldaemon.com>, Chris says...
 In article <ds14nl$16h7$1 digitaldaemon.com>, Kevin Watters says...
 struct Thing {
 int[5] vals = 3;
 }

 void main() {
 Thing t, g;

 printf("%d %d\n", t.vals[0], g.vals[0]);
 }

 I get this output: 3 622879781

 Is the compiler missing the array assignment on the second struct
 initialization?
my output: 3 3 perhaps you aren't using the newest version of dmd.exe?
Feb 04 2006
parent Sean Kelly <sean f4.ca> writes:
For what it's worth, I'm not seeing that error in my local build.  So 
this should either be fixed in the latest Ares release or it will be 
fixed in the next--I've been working on the C headers a bit so it could 
be a change that hasn't been made public yet.


Sean

Sean Kelly wrote:
 Crazy.  I'll look into it.
 
 Sean
 
 Kevin Watters wrote:
 OK it did work with Phobos.

 So it's a definite bug in Ares. I'll post it in the dsource.org Ares 
 form.

 Thanks for the help.

 In article <ds2dfh$23j1$1 digitaldaemon.com>, Dave says...
 0.145 (phobos) on both Linux and Windows working Ok for me as well. 
 Try  it with
 phobos once just for kicks.

 In article <ds1ijd$1efp$1 digitaldaemon.com>, Kevin Watters says...
 Definitely using 0.145, with Ares though--but I'm sure that wouldn't 
 be the
 problem. I ran into it while crafting a template vector class.

 Can anyone else reproduce this?

 In article <ds1d21$1bml$1 digitaldaemon.com>, Chris says...
 In article <ds14nl$16h7$1 digitaldaemon.com>, Kevin Watters says...
 struct Thing {
 int[5] vals = 3;
 }

 void main() {
 Thing t, g;

 printf("%d %d\n", t.vals[0], g.vals[0]);
 }

 I get this output: 3 622879781

 Is the compiler missing the array assignment on the second struct
 initialization?
my output: 3 3 perhaps you aren't using the newest version of dmd.exe?
Feb 04 2006