www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - DMD 0.123 static array wrong size

reply Michael Butscher <mbutscher gmx.de> writes:
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 15 2005
next sibling parent "Walter" <newshound digitalmars.com> writes:
This is a serious bug. I've got it fixed now, will go out in next update.
May 16 2005
prev sibling parent Thomas Kuehne <thomas-dloop kuehne.thisisspam.cn> writes:
-----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-----
May 17 2005