Microsoft KB Archive/106398

From BetaArchive Wiki
< Microsoft KB Archive
Revision as of 10:08, 20 July 2020 by X010 (talk | contribs) (Text replacement - """ to """)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

FIX: Unreferenced Static Functions Cause C1001 Error


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 : kb16bitonly kbCompiler
Issue type :
Technology : kbVCsearch kbAudDeveloper kbCVCComp

Last Reviewed: May 5, 2001
© 2001 Microsoft Corporation. All rights reserved. Terms of Use.