www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - Compiler Segfault

reply Dave <Dave_member pathlink.com> writes:
Was porting some code from java, missed something, and ran into a compiler
segfault.

The code below recreates the problem during the 'semantic3' pass of the DMD
compiler (v0.108).

int e0 = 10;
int e1 = 10;
void main()
{
double[][] dda = new double[e0][e1];
}

If [e0] is replaced with [10], the compiler doesn't segfault but issues an error
as expected.

- Dave
Dec 03 2004
parent "Carlos Santander B." <csantander619 gmail.com> writes:
"Dave" <Dave_member pathlink.com> escribió en el mensaje 
news:coq1c8$1fl7$1 digitaldaemon.com...
|
| Was porting some code from java, missed something, and ran into a compiler
| segfault.
|
| The code below recreates the problem during the 'semantic3' pass of the DMD
| compiler (v0.108).
|
| int e0 = 10;
| int e1 = 10;
| void main()
| {
| double[][] dda = new double[e0][e1];
| }
|
| If [e0] is replaced with [10], the compiler doesn't segfault but issues an 
error
| as expected.
|
| - Dave
|
|

The compiler shouldn't segfault, but the syntax isn't right either.
Do this:

double [][] dda;
dda.length = e1;
foreach ( inout double [] d ; dda )
    d.length = e0;

I'm not sure if I messed up the lengths, but that's the idea.

-----------------------
Carlos Santander Bernal 
Dec 03 2004