www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - trouble with bit[]

reply "Regan Heath" <regan netwin.co.nz> writes:



































output:

ASC:00001100 00001100 00001100 00001100
TMP:0000110
SMS:0000110
TMP:         0000110
SMS:0000110  0010111
TMP:                  0000110
SMS:0000110  0010111  0010000
TMP:                           0000110
SMS:0000110  0010111  0010000  0100000

'tmp' is appended to 'sms' each time round the loop, but something is  
going very wrong.

Anyone got any ideas?

Regan
Mar 16 2005
next sibling parent Derek Parnell <derek psych.ward> writes:
On Thu, 17 Mar 2005 13:48:23 +1300, Regan Heath wrote:



































 
 output:
 
 ASC:00001100 00001100 00001100 00001100
 TMP:0000110
 SMS:0000110
 TMP:         0000110
 SMS:0000110  0010111
 TMP:                  0000110
 SMS:0000110  0010111  0010000
 TMP:                           0000110
 SMS:0000110  0010111  0010000  0100000
 
 'tmp' is appended to 'sms' each time round the loop, but something is  
 going very wrong.
 
 Anyone got any ideas?
 
 Regan
I think you found a bug. Here another way to show the same bug... <code> import std.stdio; void displayb(char[] name, bit[] x) { writef("%-5s: ", name); foreach(bit b; x) writef("%d",b); writefln(""); } void main() { bit[] a; bit[] b; a.length = 7; a[0] = 0; a[1] = 1; a[2] = 1; a[3] = 0; a[4] = 0; a[5] = 1; a[6] = 0; displayb("a", a); b ~= a; displayb("b1", b); b ~= a; displayb("b2", b); b.length = 0; b ~= a; displayb("b3", b); b.length = b.length + 7; for(int i = 0; i < a.length; i++) b[i+7] = a[i]; displayb("b4", b); } <code> -- Derek Melbourne, Australia 17/03/2005 12:12:15 PM
Mar 16 2005
prev sibling parent =?ISO-8859-15?Q?Thomas_K=FChne?= writes:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Regan Heath wrote:



































|
| output:
|
| ASC:00001100 00001100 00001100 00001100
| TMP:0000110
| SMS:0000110
| TMP:         0000110
| SMS:0000110  0010111
| TMP:                  0000110
| SMS:0000110  0010111  0010000
| TMP:                           0000110
| SMS:0000110  0010111  0010000  0100000
|
| 'tmp' is appended to 'sms' each time round the loop, but something is
| going very wrong.
|
| Anyone got any ideas?

Added to DStress as
http://dstress.kuehne.cn/run/opCatAssign_09.d
http://dstress.kuehne.cn/run/opCatAssign_10.d

Thomas

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.0 (MingW32)

iD8DBQFCQ80y3w+/yD4P9tIRArSDAKDBCfpKkhA1hiqT82MMf5awHWRwAgCeOu2H
VF/lhXghcKeAsr8zYlUqY/4=
=um0P
-----END PGP SIGNATURE-----
Mar 25 2005