FIX: C4713: Internal Compiler Error, grammar.c, line 168

ID: Q116440

1.50 WINDOWS kbtool kbfixlist kbbuglist

The information in this article applies to:

SYMPTOMS

Compiling the sample code shown below with /Oe and /Oi optimizations causes the compiler to generate one of the following error messages:

   warning C4713: Scroll: internal compiler error; restarting
           ( compiler file '@(#) grammar.c:1.147', line 168 )

CAUSES

If both /Oe (global register allocation) and /Oi (intrinsic function generation) are used, and the compiler finds an expression too complicated for this optimization, the compiler fails to generate the optimized code. However, the compiler is able to detect the problem at a point where it can restart the code-generation process and not optimize the function where the error was detected.

This is just a warning; the resulting code should be correct.

RESOLUTION

To eliminate the warning message, do one of the following:

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 2.0.

MORE INFORMATION

You can use the following sample code to demonstrate this problem:

Sample Code

/* Compile options needed: /Oe /Oi
*/ 

   #include <string.h>

   short NRow, NCol, BRow;
   short ScrnMem[80];

   /* Uncomment this line to work around the problem */ 
   /* #pragma optimize( "ei", off ) */ 

   void Scroll(short nlines)
   {
      if ( nlines != 0 )
         memset(&ScrnMem[NRow*NCol], 0, (NRow-
   BRow)*NCol*sizeof(ScrnMem[0]));
   }

   /* Uncomment this line to work around the problem */ 
   /* #pragma optimize( " ", on ) */ 

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

Last Reviewed: September 22, 1997