C1001: Internal Compiler Error: newcode.c, Line 551

ID Number: Q61621

6.00 | 6.00

MS-DOS | OS/2

buglist6.00 fixlist6.00a

Summary:

The Microsoft C Compiler version 6.0 produces the following internal

compiler error when the sample program below is compiled for large

(/AL) or compact (/AC) memory models with default optimization:

file.c(21) : fatal error C1001: Internal Compiler Error

(compiler file '@(#)newcode.c:1.87', line 551)

Contact Microsoft Product Support Services

Compiling with /Od or placing the #pragma optimize("ct",off) in the

code causes the compiler to disable default optimizations, thus

working around the problem.

If optimizations are really needed then they may be turned back on

with the #pragma optimize("ct",on). Also, instead of turning off

optimizations for the function, you may add global optimizations (/Og)

to the default optimizations to work around the problem.

Microsoft has confirmed this to be a problem in C version 6.0. This

problem was corrected in C version 6.0a.

Sample Code

-----------

/* Compile options needed: /AL

*/

struct AREASTR

{

int *getnum;

int **ypos, **xpos, **varnum;

};

struct AREASTR *z;

// #pragma optimize("ct",off) Disabling optimizations for this function

// will work around problem.

// #pragma optimize("gct",on) Adding global optimization will also work

// around problem.

sample_func()

{

int i,k,no;

int count, tx, ty, tnum;

if (k<= z->getnum[no] && z->varnum[no][k] == 1)

{

tnum = z->varnum[no][count];

//compiler crashes here

tx = z->xpos[no][count];

ty = z->ypos[no][count];

z->varnum[no][count] = z->varnum[no][k];

z->xpos[no][count] = z->xpos[no][k];

z->ypos[no][count] = z->ypos[no][k];

z->varnum[no][k] = tnum;

z->xpos[no][k] = tx;

z->ypos[no][k] = ty;

}

}

/* #pragma optimize("ct",on) enable time optimizations */

Additional reference words: 6.00 6.00a