C1001: Internal Compiler Error: cgcanon.c, Lines 3078 and 3052

ID Number: Q73038

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 errors when the sample program below is

compiled with default optimization:

With C 6.0a and 6.0ax

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

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

(compiler file '@(#)cgcanon.c:1.64', line 3078)

Contact Microsoft Product Support Services

With C 6.0

----------

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

(compiler file '@(#)cgcanon.c:1.58', line 3052)

Contact Microsoft Product Support Services

The following workarounds may be used to eliminate these errors:

1. Break the complex expression into smaller subexpressions by using

temporary variables. This is the easiest solution in this

particular case and is demonstrated in the commented code in the

example below.

-or-

2. Use far pointers instead of based pointers.

-or-

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

-or-

4. Change the level of optimizations. This problem will or will not

occur, depending upon which optimizations are used. For instance,

the problem occurs with /Od, /Os, or /Ot, but does not happen if

you use /Ox.

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 : none

*/

typedef char _based ( (_segment) _self) *TEXTPTR;

typedef struct MENUDATA {

unsigned value;

TEXTPTR textptr;

} far * FPMENUDATA;

void code_fragment(void)

{

FPMENUDATA fpMD;

unsigned index;

char far * fpstr;

TEXTPTR tmp;

fpstr = fpMD->textptr + (index);

/* Uncomment the next two lines to work around the problem */

// tmp = fpMD->textptr;

// fpstr = tmp + (index-1);

fpstr = fpMD->textptr + (index-1);

}