www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - weird array-related bug (segfault) (at least)under linux (.d source included)

Greetings,

I'm using the dmd compiler (v 0.95) (I believe - downloaded July 17th) under
Linux (Redhat 9, kernel 2.4.26).
I haven't had the chance to try it under Windows.

I tried to make the source shortest possible while the bug still manifests,
so don't think about it's usefulness (actually, I tried to create a letter
frequency counter).

The size of 233 isn't arbitrary, it manifests from 233 upwards.
When I remove the foreach, it disappears. It also disappears when
i call printf (ANYTHING); before the foreach or even before the int[233] b=...

Removing the char[] f from frqcount () removes it also.

Please, take a look at it.

int
main (char[][] args)
{
int[233] a = 0;

foreach (char[] c; args)
int[233] b = frqcount (c);

return 0;
}


int[]
frqcount (char[] fn)
{
int[233] l = 0;
char[] f;
return l;    
}

Thank you,
Martin HRADIL <himdel seznam.cz>
Jul 18 2004