FIX: C1001: main.c, Line 826 or 831 From Optimization

Last reviewed: September 16, 1997
Article ID: Q100538
7.00 | 1.00 MS-DOS | WINDOWS kbtool kbfixlist kbbuglist

The information in this article applies to:

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

        - Microsoft C/C++ for MS-DOS, versions 7.0
        - Microsoft Visual C++ for Windows, version 1.0
    

SYMPTOMS

An attempt to compile the code example provided below with the /f- and /Oi compiler options specified fails and Microsoft C/C++ generates one of the following messages. For Microsoft C/C++ version 8.0:

   fatal error C1001: internal compiler error
   (compiler file '@(#)main.c:1.27', line 831)

For Microsoft C/C++ version 7.0:

   fatal error C1001: INTERNAL COMPILER ERROR
   (compiler file '@(#)main.c:1.27', line 826)

RESOLUTION

There are three methods to work around this problem, as follows:

  • Edit the compiler command line to remove the /Oi option switch.
  • Use #pragma optimize to disable optimizations from the function that causes the problem. The code example below demonstrates the appropriate pragma.
  • Compile the application with the fast compiler (specify /f on the compiler command line) instead of the optimizing compiler (specify /f- on the compiler command line).

STATUS

Microsoft has confirmed this to be a problem in C/C++ versions 7.0 and 8.0 for MS-DOS. This problem was corrected in C/C++ version 8.0c for MS-DOS, included with Visual C++ for Windows version 1.5.

MORE INFORMATION

The following code example demonstrates this error. You can work around this problem by removing the comment from the #pragma optimize statements in the code below.

Sample Code

/*
 * Compile options needed: /f- /Oi
 */

// #pragma optimize("", off);

double func(const double x, double &dt) {
   double y = 0.0;

   if (x == 0.0)
      dt = 1.0;
   else
      _asm  f2xm1
   return y;
}

// #pragma optimize("", on);


Additional reference words: 7.00 1.00
KBCategory: kbtool kbfixlist kbbuglist
KBSubcategory: CPPIss
Keywords : CPPIss kb16bitonly kbbuglist kbfixlist kbtool
Version : 7.00 | 1.00
Platform : MS-DOS 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 16, 1997
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.