C1001: Internal Compiler Error: regMD.c, Lines 2937 and 2910

ID Number: Q70670

6.00 6.00a | 6.00 6.00a

MS-DOS | OS/2

Summary:

The Microsoft C Compiler versions 6.00 and 6.00a produce the following

internal compiler errors when the sample program below is compiled

with huge memory model (/AH) and default optimizations:

With C 6.00a

------------

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

(compiler file '@(#)regMD.c:1.10', line 2937)

Contact Microsoft Product Support Services

With C 6.00

-----------

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

(compiler file '@(#)regMD.c:1.00', line 2910)

Contact Microsoft Product Support Services

There are several ways to work around this problem:

1. Break the complex expression into smaller subexpressions by using

temporary variables.

-or-

2. Use /Od (no optimizations) or /Os (size optimization) instead of

/Ot (time optimization), which is the default. The sample workaround

below illustrates this solution using pragmas.

-or-

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

Microsoft has confirmed this to be a problem in C versions 6.00 and

6.00a. This problem was corrected in C version 7.0.

Sample Code

-----------

/* Compile options needed: /AH /c

To work around the problem, remove the comment before the pragmas.

*/

struct Image_Line

{

unsigned long _far *red, _far *green, _far *blue;

};

struct Image_Struct

{

struct Image_Line *rgb_lines;

};

void Read_Image(struct Image_Struct *Image, unsigned long creg);

//#pragma optimize( "t" , off )

void Read_Image(struct Image_Struct *Image, unsigned long creg)

{

int j;

struct Image_Line *line;

line = &Image->rgb_lines[j];

line->red[j] = (creg >> 16) & 0xFF; /* Error Occurs Here */

}

//#pragma optimize( "t" , on )