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

Last reviewed: September 18, 1997
Article ID: Q116440
1.50 WINDOWS kbtool kbfixlist kbbuglist

The information in this article applies to:

  • The Microsoft C/C++ Compiler (CL.EXE), included with:

        - Microsoft Visual C++ for Windows, version 1.5
    

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:

  • Turn on the fast compiler option, /f.

    -or-

  • Turn off one of the options, /Oe or /Oi, or turn off both options. This also can be done using #pragma optimize(). See the sample code in the "MORE INFORMATION" section, below.

    -or-

  • Simplify the complex expression. For example, assign part of the expression to a temporary variable, then use the temporary variable in its place in the expression.

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 : CLIss kb16bitonly kbbuglist kbfixlist kbtool
Version : 1.50
Platform : WINDOWS
Solution Type : kbfix


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: September 18, 1997
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.