FIX: Nested Loops Cause Internal Compiler Error in msc1.cpp

Last reviewed: September 18, 1997
Article ID: Q115537
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

Compiling code that contains deeply nested loops, as demonstrated in the sample source code in the "MORE INFORMATION" section below (which contains 16 nested loops), produces the following internal compiler error, regardless of the command-line optimizations used:

      fatal error C1001: internal compiler error
                         (compiler file 'msc1.cpp', line 581)

RESOLUTION

If possible, change the source code to reduce the number of nested loops.

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

With the Microsoft C compiler, version 6.0, the sample code below causes a C1026 "parser stack overflow, program too complex" error to be generated. No errors or warnings are generated with the C/C++ compiler, version 7.0. The C1001 error is generated with C/C++, version 8.0.

Sample Code

/* Compile options needed: none
*/
      void main(void)
      {
       int i = 0;

       for(;i<2;)
        for(;i<2;)
         for(;i<2;)
          for(;i<2;)
           for(;i<2;)
            for(;i<2;)
             for(;i<2;)
              for(;i<2;)
               for(;i<2;)
                for(;i<2;)
                 for(;i<2;)
                  for(;i<2;)
                   for(;i<2;)
                    for(;i<2;)
                     for(;i<2;)
                      for(;i<2;)
                         i = 2;   /* error occurs on this line */
      }


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.