FIX: C4713 Internal Compiler Error, file reg86.c, line 2934

ID: Q115850

1.00 WINDOWS kbtool kbfixlist kbbuglist

The information in this article applies to:

SYMPTOMS

The optimizing C/C++ compiler generates the following internal compiler error message when the sample code below is compiled with the /Ox or /Oe compiler options:

   warning C4713: test: internal compiler error; restarting
             ( compiler file '@(#)reg86.c:1.26', line 2934 )

CAUSE

The internal compiler error message is caused by using the global register allocation optimization.

This is only a warning message. The compiler restarts the compile without the optimization after it realizes a problem has occurred due to the global register allocation optimization.

RESOLUTION

There are four workarounds to avoid the warning message:

1. Use the fast compiler option /f.

   -or-

2. Remove the /Oe compiler option to disable the global register
   allocation. If /Ox is used, /Oe is automatically invoked. If other
   optimizations invoked by /Ox are still needed, do the follows:

   a. Take out /Ox from the compiler options.

   b. Add the following options: /Ob1 /Oc /Og /Oi /Ol /On /Oo /Ot /Gs

   -or-

3. Use the optimize pragma to disable /Oe before the function where
   the error occurs. For example:

      #pragma optimize("e", off )

      short test( PSTRUCTURE ptr )
      {
      /* ... */ 
      }

      #pragma optimize( "",on )

4. In the sample below, swap lines 16 and 17. This has no semantic impact
   on the code.

STATUS

Microsoft has confirmed this to be a problem in the Microsoft products listed above. This problem was corrected in Visual C++ version 1.5.

MORE INFORMATION

The following sample can be used to demonstrate the problem.

Sample Code

/* Compile options needed: /Oe -or- /Ox
*/ 

Line 1  :     typedef struct STRUCTURE
Line 2  :     {
Line 3  :         char* string1;
Line 4  :         char* string2;
Line 5  :         short index;
Line 6  :     } *PSTRUCTURE;
Line 7 :
Line 8  :     int ch;
Line 9 :
Line 10 :     short test( PSTRUCTURE ptr)
Line 11 :     {
Line 12 :       for (;;)
Line 13 :       {
Line 14 :         if ( ch == '/' )
Line 15 :         {
Line 16 :           ptr->index = 2;    // warining: C4713
Line 17 :           ptr->string2 = ptr->string1;
Line 18 :           return 0;
Line 19 :         }
Line 20 :
Line 21 :         if (ch == '\\' )
Line 22 :         {
Line 23 :           ch = *ptr->string1;
Line 24 :           continue;
Line 25 :         }
Line 26 :       }
Line 30 :     }

Additional reference words: 1.00 8.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