FIX: Unreferenced Static Functions Cause C1001 Error

ID: Q106398

1.00 WINDOWS kbtool kbfixlist kbbuglist

The information in this article applies to:

SYMPTOMS

The sample code belows generates the error:

   fatal error C1001: internal compiler error
                   (compiler file '', line 1308)

CAUSE

The compiler fails because the function in the sample code below is declared as static, it is not referenced in the same source file by any other function, and it contains a static character pointer initialized to point to a string constant. The error occurs only under these very specific conditions.

RESOLUTION

To work around the problem, compile with the /f- option or add optimizations to invoke the optimizing code generator rather than the fast code generator. The optimizing code generator will successfully compile the code.

Alternatively, you could change either the function or the character pointer so they are not declared static.

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.

Sample Code

/* Compile options needed: none
*/ 

static void fcn( void ) {
    static char *psz = "string";
}

Additional reference words: 1.00 8.00 KBCategory: kbtool kbfixlist kbbuglist KBSubcategory: CLIss

Keywords          : kb16bitonly kbCompiler kbbuglist kbfixlist
Version           : 1.00
Platform          : WINDOWS
Solution Type     : kbfix

Last Reviewed: September 20, 1997