BUG: C1001: pgoMD.c, Line 4578 or 4877 Compiling for 80386

ID: Q113110

1.00 1.50 WINDOWS kbtool kbbuglist

The information in this article applies to:

SYMPTOMS

The compiler generates one of the following internal compiler error messages when the sample program below is compiled with /G3 to target the 80386 processor. The C/C++ version 8.0 compiler produces:

   fatal error C1001: internal compiler error
      (compiler file '@(#)pgoMD.c:1.21', line 4578)

The C/C++ version 8.0c compiler produces:

   fatal error C1001: internal compiler error
      (compiler file '@(#)pgoMD.c:1.21', line 4877)

The internal compiler error is triggered by using the /G3 option with post- code-generation optimization (/Oo). Note that the post-code-generation optimization is on by default.

RESOLUTION

To avoid the problem, one option is to use the /G2 compiler switch instead of the /G3 compiler switch. Another option is to disable the post-code- generation optimization. This can be done by either using the /Oo- option on the command line or by using #pragma optimize to disable the optimization in the source file. The comments in the sample below demonstrate using the #pragma to work around the problem.

STATUS

Microsoft has confirmed this to be a problem in C/C++ for MS-DOS versions 8.0 and 8.0c. We are researching this problem and will post new information here in the Microsoft Knowledge Base as it becomes available.

Sample Code

/* Compile options needed: /c /f- /G3 */ 
/* Workaround compiler options: /c /Oo /f- /G3 */ 

int func1 (char *);
int func2 (long, int);
int func (int, long);

// Uncomment for workaround:
// #pragma optimize ("o", off)

int func (int nParam, long dParam)
{
    char szLocal[4];
    long dLocal;

    switch (nParam)
    {
    case 1:
        f1 (szLocal);
        break;
    case 2:
        dLocal = dParam;
        f2 (dLocal, nParam* 2);
        break;
    default:
        break;
    }
    return 0;
}

// Uncomment for workaround:
// #pragma optimize ("", on)

Additional reference words: 1.00 1.50 8.00 8.00c KBCategory: kbtool kbbuglist KBSubcategory: CLIss Keywords : kb16bitonly

Last Reviewed: July 23, 1997