C1001: Internal Compiler Error: pgo2.c, Line 243

ID Number: Q72730

6.00 6.00a 6.00ax | 6.00 6.00a

MS-DOS | OS/2

buglist6.00 buglist6.00a buglist6.00ax fixlist7.00

Summary:

The Microsoft C Compiler versions 6.0, 6.0a, and 6.0ax produce the

following internal compiler error when the sample program below is

compiled with default optimization for compact (/AC), large (/AL), or

huge (/AH) memory model:

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

(compiler file '@(#)pgo2.c:1.41', line 243)

Contact Microsoft Product Support Services

More Information:

The following are valid workarounds for this error:

1. Disable all optimization (/Od) or compile using only the /Oe, /Og,

/Oi, /Ol, or /Ox optimization switches.

-or-

2. Convert the ternary expression in the code to an equivalent if-else

construct.

-or-

3. Compile with the /qc (quick compile) option.

-or-

4. Use the "#pragma optimize" directive to turn off optimizations only

for the function in which the error is occurring (see the comments

in the code below for an example of this).

-or-

5. Compile for small (/AS) or medium (/AM) memory model, if possible.

Microsoft has confirmed this to be a problem in C versions 6.0, 6.0a,

and 6.0ax. This problem was corrected in C/C++ version 7.0.

Sample Code

-----------

/* Compile options needed: /AL, /AH, or /AC

*/

long msb_time;

typedef struct{

long intvl;

long last;

} avg_data;

static avg_data avg[2];

// #pragma optimize("", off) // uncomment for workaround

char sync_isp(char mte)

{

avg_data *ch;

ch = (mte & 8) ? &avg[1] : &avg[0];

if (ch->intvl > 1)

{

ch->intvl += msb_time - ch->last;

ch->last = msb_time;

}

}

// #pragma optimize("", on) // uncomment for workaround