Thread overview
DMD 0.123 static array wrong size
May 15, 2005
Michael Butscher
May 16, 2005
Walter
May 17, 2005
Thomas Kuehne
May 15, 2005
The following code works if compiled by DMD 0.121, but crashes with 0.123 because the reserved size for bigarray in the data segment is then only 100 bytes instead of the needed 100*100*4 bytes (tested on Windows ME):

------------------------------------------------------------

static int bigarray[100][100];

int main(char[][] args)
{
  for (int i = 0; i < 100; i += 1)
  {
    for (int j = 0; j < 100; j += 1)
    {
      printf("Array %i %i\n", i, j);
      bigarray[i][j] = 0;
    }
  }

  return 0;
}

------------------------------------------------------------


Michael
May 16, 2005
This is a serious bug. I've got it fixed now, will go out in next update.


May 17, 2005
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Michael Butscher schrieb am Sun, 15 May 2005 19:08:48 +0200:
>
> The following code works if compiled by DMD 0.121, but crashes with 0.123 because the reserved size for bigarray in the data segment is then only 100 bytes instead of the needed 100*100*4 bytes (tested on Windows ME):
>
> ------------------------------------------------------------
>
> static int bigarray[100][100];
>
> int main(char[][] args)
> {
>   for (int i = 0; i < 100; i += 1)
>   {
>     for (int j = 0; j < 100; j += 1)
>     {
>       printf("Array %i %i\n", i, j);
>       bigarray[i][j] = 0;
>     }
>   }
> 
>   return 0;
> }
>
> ------------------------------------------------------------

Added to DStress as http://dstress.kuehne.cn/run/a/array_initialization_16.d

Thomas

-----BEGIN PGP SIGNATURE-----

iD8DBQFCijSM3w+/yD4P9tIRAsClAKCXR/SpFYngBB0Mi5jLPF+yq4SNrwCgxnED
GxFXwrvkZhSx4xpABprV5Ik=
=W81K
-----END PGP SIGNATURE-----