Microsoft KB Archive/115324

{|
 * width="100%"|

FIX: Macro Subscript Causes Internal Compiler Error

 * }

Q115324

7.00 | 1.00 MS-DOS | WINDOWS kbtool kbfixlist kbbuglist -- The information in this article applies to: - The Microsoft C/C++ Compiler (CL.EXE), included with: - Microsoft C/C++ for MS-DOS, version 7.0 - Microsoft Visual C++ for Windows, version 1.0 -- SYMPTOMS ======== The C/C++ compiler, version 8.0, produces the following warning message (followed by an internal compiler error) if the source code at the end of this article is compiled under the large memory model using full optimization: warning C4713: internal compiler error: restarting (compiler file '@(#)reg86.c:1.26', line 4600) fatal error C1001: internal compiler error (compiler file '@(#)reg86.c:1.26', line 4600) Under the C/C++ compiler version 7.0, the same warning and error are generated, except that the reg86.c line number is 4479. Furthermore, using #pragma optimize does not remove both errors. If #pragma optimize is used, only the C1001 error is generated. CAUSE ===== The warning and error are generated as a result of using a call to a macro to create a subscript value for accessing an array of structures. RESOLUTION ========== Removing the /Oe option from the optimizations causes the C4713 warning to disappear; however, the C1001 error still remains. There are two ways to get rid of the C1001 error: - Compile with /Od to disable all optimization. -or- - Use the fast compiler option, /f. STATUS ====== Microsoft has confirmed this to be a bug in the products listed above. This problem was corrected in Visual C++ for Windows, version 1.5. MORE INFORMATION ================ The following sample code can be used to demonstrate the problem: Sample Code --- /* Compile options needed: /AL /c /Ox */ #include typedef struct flist_links { long next; long prev; } FLIST_LINKS; typedef struct mem_flist { long my_addr; long next; long prev; } MEM_FLIST; typedef struct flist { FILE *stream; int cache_number; int flush; MEM_FLIST ptrs; } FLIST; #define MAX_NAVES_NAME 384 #define NUM_LEVEL_LISTS 6 typedef struct naves_file_struct { MEM_FLIST whole_list; FLIST_LINKS level_list; unsigned char flags; char name[MAX_NAVES_NAME]; long verse_list_offset; } NAVES_FILE_STRUCT; FLIST WholeList; FLIST LevelLists[NUM_LEVEL_LISTS]; int DeleteNavesEntry(NAVES_FILE_STRUCT *NFS); int FL_FromList(MEM_FLIST *Element,FLIST *List); #define GET_NAVES_LEVEL(c) ((c) & (char) 7) //#pragma optimize("", off) int DeleteNavesEntry(NAVES_FILE_STRUCT *NFS) { MEM_FLIST flist; int err; err = FL_FromList(&flist,&LevelLists[GET_NAVES_LEVEL(NFS->flags)]); } //#pragma optimize("", on) Additional reference words: 7.00 8.00 1.00 KBCategory: kbtool kbfixlist kbbuglist KBSubcategory: CLIss

Keywords : kb16bitonly kbCompiler

Issue type :

Technology : kbVCsearch kbAudDeveloper kbCVCComp