Read-only archive of the Armageddon Games Forums Archive (2000–2026) · About this archive

Compiler crash

11 replies · 2,554 views · Started 24 May 2008

This will apparently crash the compiler each and every time:

							for(int i=1;i<=48;i++){
save_link_x[i] += save_link_x[n]-lx;
save_link_y[i] += save_link_y[n]-ly;
}

Pass 1: Parsing
Pass 2: Preprocessing
Pass 3: Building symbol tables
Pass 4: Type-checking/Completing function symbol tables/Constant folding
Pass 5: Generating object code

Whereas this:

							for(int i=1;i<=48;i++){
save_link_x[i] = save_link_x[i]+spacing_difference-lx;
save_link_y[i] = save_link_x[i]+option_orbit-ly;
}

compiles just fine. Maybe an error message at least? This one gave me quite the headache for a while.

They are all declared ya. 😊

The difference is something like this:

array[n] += array[n];

vs.

array[n] = array[n] + array[n];

I can confirm this in windows build 813.
A sample breaking script:

import "std.zh"

ffc script ArrayTest {
void run()
{
int loopCount;
int testArray[256];
for (loopCount = 0; loopCount < 256; loopCount++)
{
testArray[loopCount] = loopCount;
}
for (loopCount = 0; loopCount < 255; loopCount++)
{
testArray[loopCount]+=5;
}
}
}

From what I've seen, +=, -=, *=, /=, |=, &=, and ^= all cause a crash at the assembly step when a custom defined array comes before them. However, ++ and -- are perfectly fine. Engine defined arrays such as Game->Counter[] do not crash when they come before these operations.

Fortunately, we know the problem, it's just a matter of fixing it.

Since I'm the one who implemented arrays into the language, this would be my department.

Any progress on this jman?

It's a real pain having to type out a[i]->X = a[i]->X + 2; all the time...

I just tested it and it's still crashing the compiler for me.

e[i]->X += offset[i]*RadianCos(angle[i]+(PI/2));

Was the culprit.

I just entered that line into the compiler (with the proper array declarations of course) and it compiled just fine.

Do you have a bigger excerpt?