FIX: C4713: reg86.c, line 3799

Last reviewed: September 18, 1997
Article ID: Q114069
1.00 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.0
    

SYMPTOMS

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

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

The internal compiler error is triggered by using the global register allocation optimization (/Oe). Note that global register allocation is included with the /Ox compiler option.

RESOLUTION

The C4713 message is just a warning. The compiler realizes a problem has occurred due to the global register allocation optimization and restarts the compile without the optimization.

To avoid the message, one option is to use the fast compiler (/f) instead of the optimizing compiler. Another option is to disable the global register allocation optimization. This can be done by either not using the /Oe 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.

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- /Oe
*/

typedef char ARRAY[8];

typedef struct _table1 {

    ARRAY aItem[4];
} TABLE1;

typedef struct _table2 {

    int nItem;
    union
    {
     TABLE1 far * t1Item;
    };
} TABLE2;

typedef struct _table3 {

    TABLE2 t2Item[4];
} TABLE3;

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

void func(
    TABLE3 far * t3Param,
    int nParam)
{
    TABLE2 far * pt2Local1;
    TABLE2 far * pt2Local2;
    int nLocal1;
    int nLocal2;
    ARRAY far * paLocal;
    int nIndex;

    pt2Local1 = &t3Param->t2Item[2];
    pt2Local2 = &t3Param->t2Item[1];

    nLocal1 = pt2Local1->nItem;
    nLocal2 = pt2Local2->nItem;

    if (nParam)
     paLocal = pt2Local1->t1Item->aItem;

    for (nIndex = 0; nIndex < nLocal2; )
     nIndex++;
}

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


Additional reference words: 8.00 1.00
KBCategory: kbtool kbfixlist kbbuglist
KBSubcategory: CLIss
Keywords : CLIss kb16bitonly kbbuglist kbfixlist kbtool
Version : 1.00
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.