BUG: C1001: Internal Compiler Error, File main.c

Last reviewed: July 22, 1997
Article ID: Q115524
7.00 | 1.00 1.50 MS-DOS | WINDOWS kbtool kbbuglist

The information in this article applies to:

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

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

SYMPTOMS

The use of time optimization on a source file containing an inline assembly jump to code outside the assembly block may generate an internal compiler error, as demonstrated in the sample code below:

Under C/C++, version 7.0, the following error is generated:

   test.c(15) : fatal error C1001: INTERNAL COMPILER ERROR
                (compiler file '@(#)main.c:1.27', line 826)
                Contact Microsoft Product Support Services

With the C/C++ compiler version 8.0, a similar error is generated:

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

C/C++, version 8.0c, generates the same error, except with a different line number:

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

RESOLUTION

There are two workarounds to this problem:

  • Use the fast compiler option, /f.

    -or-

  • Disable optimization during the function where the error occurs by using the optimize pragma:

             #pragma optimize("",off)
    
             void bad_function(void)
             {
                /* ... */
             }
    
             #pragma optimize("",on)
    
    

STATUS

Microsoft has confirmed this to be a bug in the products listed above. We are researching the problem and will post new information here in the Microsoft Knowledge Base as it becomes available.

This problem does not occur using C/C++, version 8.0, included with Visual C++, 32-bit Edition, version 1.0.

MORE INFORMATION

The following sample code can be used to demonstrate this problem:

Sample Code

/* Compile options needed: /c /Ot
*/
      int validate_Float( float nf )
      {
         __asm
         {
            finit
            fld nf
            ftst
            fnstsw ax
            finit
            and ax, 0x0400
            jz point
         }
         return 0;
      point:
         return 1;
      }

      void main()
      {
         float f = 1;
         validate_Float( f );
      }


Additional reference words: 1.00 1.50 7.00 8.00 8.00c
KBCategory: kbtool kbbuglist
KBSubcategory: CLIss
Keywords : kb16bitonly


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: July 22, 1997
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.