FIX: Unreferenced Static Functions Cause C1001 Error

Last reviewed: September 16, 1997
Article ID: Q106398
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, versions 1.0
    

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