www.digitalmars.com         C & C++   DMDScript  

D.gnu - strange behaviour with out of bounds exception and tango

I am not totally sure this is a gdc bug, but there are strong hints that it is.
The out-of bounds exception seem to garble the stack in a fully 
reproducible way on darwin (10.4 intel, gdc r 209), and to crash on 
Linux x86.
gdc Linux x86_64 and DMD x86 work.

a sample file showing this behaviour is:
-------------
// a good place to set the breakpoint is genobj.d:968
// (post garbling), and lifetime.d:99 (and later lifetime.d:103)
// (pre garbling)
module hello_tango;
void main(char [][] argv)
{
    int []a=new int[10];
    a.length=5;
    int b=a[6];
}
-----------

With tango it fails, the corresponding tango ticket is
	http://www.dsource.org/projects/tango/ticket/1094

I suspect that this is connected with the part of the code that 
extracts filename and line number for the array exception (or, but more 
unlikely, with the last-call optimization, or inlining that removes the 
_d_array_bounds call from the stack).

Unfortunately I wasn't able to reproduce the bug with phobos, but I 
still suspect that it is compiler related.

Does this pass the "bug-reporteable" threshold?

Fawzi
May 09 2008