FIX: C1001: reg86.c, line 3154

ID: Q114068

1.00 WINDOWS kbtool kbfixlist kbbuglist

The information in this article applies to:

SYMPTOMS

The compiler generates the following internal compiler error message when the sample program below is compiled with /Oe and /Og or /Ox.

   fatal error C1001: internal compiler error
      (compiler file '@(#)reg86.c:1.26', line 3154)

The internal compiler error is triggered by using the global register allocation optimization (/Oe) with the global common subexpression optimization (/Og). Note that both of these optimizations are included with the /Ox compiler option.

RESOLUTION

To avoid the error, one option is to use the fast compiler (/f) instead of the optimizing compiler. Another option is to disable either the global register allocation optimization or the global common subexpression optimization. This can be done by either not using the /Oe, /Og, or /Ox options 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. Finally, casting the unsigned int, in the sample below, to an int will also resolve the problem.

STATUS

Microsoft has confirmed this to be a problem in the Microsoft products listed above. This is not a problem in Visual C++, 32-bit Edition. This problem was corrected in Visual C++ version 1.5.

Sample Code

/* Compile options needed: /c /f- /Oeg
*/ 

void func2(char, char);

// Uncomment for work around
// #pragma optimize ("e", off)

void func(unsigned uParam, int nParam)
{
    func2 ((char)nParam, (char)(uParam - nParam));
    func2 ((char)nParam, (char)(uParam + nParam));
}

// Uncomment for work around
// #pragma optimize ("", on)

Additional reference words: 8.00 1.00 KBCategory: kbtool kbfixlist kbbuglist KBSubcategory: CLIss
Keywords          : kb16bitonly kbCompiler kbbuglist kbfixlist
Version           : 1.00
Platform          : WINDOWS
Solution Type     : kbfix

Last Reviewed: September 22, 1997