Microsoft KB Archive/315481

= BUG: Too many unnested loops incorrectly causes a C1061 compiler error in Visual Studio .NET =

Article ID: 315481

Article Last Modified on 8/24/2005

-

APPLIES TO


 * Microsoft Visual Studio .NET 2002 Professional Edition
 * Microsoft Visual Studio .NET 2002 Enterprise Architect
 * Microsoft Visual Studio .NET 2002 Enterprise Developer
 * Microsoft Visual Studio .NET 2002 Academic Edition
 * Microsoft Visual Studio .NET 2003 Enterprise Developer
 * Microsoft Visual Studio .NET 2003 Academic Edition
 * Microsoft Visual Studio .NET 2003 Enterprise Architect
 * Microsoft Visual Studio .NET 2003 Professional Edition

-



This article was previously published under Q315481



SYMPTOMS
If a function contains more than approximately 250 unnested loops, you receive the following error message, which should not appear in this scenario:

&quot;fatal error C1061: compiler limit : blocks nested too deeply&quot;

The problem occurs only when you compile the source code as a C++ source file. The source code compiles without errors when you compile the source code as a C source file.



STATUS
Microsoft has confirmed that this is a bug in the Microsoft products that are listed at the beginning of this article.



Steps to Reproduce the Behavior
The following sample code demonstrates the error: /* Compile options needed: /TP /c
 * 1) include 
 * 1) include 

// The code blocks in this function have only two nesting levels. // C1061 should not occur. void func1 {   int a;    int i = 0; int count = 0;

count++; a = count; for (i=0; i<5; i++) { a += a*i; }   printf(&quot;a=%d\n&quot;, a);

// Copy and paste the following code 250 times. /*   for (i=0; i<5; i++) { a += a*i; }   printf(&quot;a=%d\n&quot;, a); */

count++; a = count; for (i=0; i<5; i++) { a += a*i; }   printf(&quot;a=%d\n&quot;, a); }

void main{ func1; }

Additional query words: kbCompiler kbVC

Keywords: kbbug kbpending kbcompiler kbvs2002sp1sweep KB315481

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.