FIX: C1001: code.c:1.25, Line 534

Last reviewed: September 18, 1997
Article ID: Q114067
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

Compiling the sample code shown below with any of the /Oc, /Oe, /Og, /Oi, or /Ol switches will cause version 8.0 of the compiler to generate the following error message:

    fatal error C1001: INTERNAL COMPILER ERROR
    (compiler file '@(#)code.c:1.25', line 534)
    Contact Microsoft Product Support Services

The same code and compiler options will cause version 7.0 of the compiler to generate the following error message:

    fatal error C1001: INTERNAL COMPILER ERROR
    (compiler file '@(#)code.c:1.25', line 473)
    Contact Microsoft Product Support Services

When compiling the sample code shown below both versions of the compiler will also generate a C4124 warning stating that __fastcall with stack checking is inefficient. However, compiling the sample code with the /Gs switch to turn off stack checking does not avoid the C1001 error.

RESOLUTION

To avoid the C1001 error, do one or more of the following:

    Do not compile with any of the /Oc, /Oe, /Og, /Oi, or /Ol
    switches.

    - or -

    Use the #pragma optimize directive to disable the optimizations
    listed above.

    - or -

    Restructure the code so that the problem does not occur. The
    piece of sample code show below is rather large because
    simplifying it at all causes the C1001 error to not occur.

    - or -

    Upgrade to Visual C++ for Windows version 1.5 since the problem
    has been fixed in that version.

STATUS

Microsoft has confirmed this to be a problem in the Microsoft products listed above. This problem was corrected with Visual C++ version 1.0.

Sample Code

/* Compile options needed:  /c and one or more of /Oc, /Oe, /Og, /Oi
* or -Ol
*/

typedef unsigned char U8;

typedef unsigned short U16; typedef U16 __far* LPU16; typedef U16 CTBYTE; typedef U16 CTPARA; typedef CTPARA __far* LPCTPARA; typedef U16 DBHHANDLE; typedef DBHHANDLE __far* LPDBHHANDLE; typedef U16 RELSEG;

typedef unsigned int MASK;

typedef unsigned long U32; typedef void __near* NPVOID; typedef void __far* LPVOID;

typedef struct tagDBHEAPINFOSTRUCT {

    CTPARA ctparaTotal;
    CTPARA ctparaAvailTotal;
    CTPARA ctparaAvailBiggest;
    CTPARA ctparaAvailBiggestIfCompacted;
    CTPARA ctparaAvailBiggestFixed;
    CTPARA ctparaAvailBiggestFixedIfComp;
    U16 ctNodesUsed;
    U16 ctNodesFree;
} DBHEAPINFOSTRUCT;

typedef DBHEAPINFOSTRUCT __far* LPDBHEAPINFOSTRUCT;

typedef struct tagDBNODEINFOSTRUCT {

    CTPARA ctparaUsed;
    CTPARA ctparaFree;
    RELSEG relsegNext;
    RELSEG relsegPrev;
    int fLocked;
} DBNODEINFOSTRUCT;

typedef DBNODEINFOSTRUCT __far* LPDBNODEINFOSTRUCT;

typedef struct tagDLHEAPINFOSTRUCT {

    CTBYTE ctbyteTotal;
    CTBYTE ctbyteAvailTotal;
    CTBYTE ctbyteAvailBiggest;
    U16 ctNodesUsed;
    U16 ctNodesFree;
} DLHEAPINFOSTRUCT;

typedef DLHEAPINFOSTRUCT __far* LPDLHEAPINFOSTRUCT;

typedef struct tagDLNODEINFOSTRUCT {

    CTBYTE ctbyteSize;
    CTBYTE ctbyteNext;
    int fFree;
} DLNODEINFOSTRUCT;

typedef DLNODEINFOSTRUCT __far* LPDLNODEINFOSTRUCT;

__segment __fastcall DBHInit ( CTPARA, MASK, U16, LPCTPARA);

void __fastcall DBHQueryHeap ( __segment, LPDBHEAPINFOSTRUCT);
void __fastcall DBHCompact ( __segment);
void __fastcall DBHTerminate ( __segment);

DBHHANDLE __fastcall DBHAlloc ( __segment, CTPARA, MASK); DBHHANDLE __fastcall DBHRealloc ( __segment, DBHHANDLE, CTPARA, MASK);
int __fastcall DBHQueryNode(__segment, DBHHANDLE, LPDBNODEINFOSTRUCT);
DBHHANDLE __fastcall DBHFree ( __segment, DBHHANDLE);

__segment __fastcall DBHLockGetSeg ( DBHHANDLE); LPVOID __fastcall DBHLockGetLP ( DBHHANDLE); DBHHANDLE __fastcall DBHUnlock ( DBHHANDLE);

int __fastcall DLHInit ( DBHHANDLE, CTBYTE);
int __fastcall DLHQueryHeap ( DBHHANDLE, LPDLHEAPINFOSTRUCT);

NPVOID __fastcall DLHAlloc ( DBHHANDLE, CTBYTE); NPVOID __fastcall DLHRealloc ( DBHHANDLE, NPVOID, CTBYTE);
int __fastcall DLHQueryNode ( NPVOID, LPDLNODEINFOSTRUCT);
void __fastcall DLHFree ( NPVOID);

typedef struct tagARENAHDR {
    U8 rgbyStamp[2];
    MASK flags;
    U16 special;
    U16 ctLock;
    RELSEG relsegNext;
    RELSEG relsegPrev;
    CTPARA ctparaData;
    DBHHANDLE dbhHandle;
} ARENAHDR;

typedef ARENAHDR __far* LPARENAHDR;

typedef struct tagHeapSegDesc HEAPSEGDESC; typedef HEAPSEGDESC __far* LPHEAPSEGDESC;

typedef struct tagHeapSegDesc {

    U16 checksum;
    U16 flags;
    U16 segsize;
    U16 start;
    U16 rover;
    U16 last;
    LPHEAPSEGDESC nextseg;
    LPHEAPSEGDESC prevseg;
} HEAPSEGDESC;

__segment ArenaSegFromHandle(__segment dhseg, DBHHANDLE dbhhnd); DBHHANDLE UnlinkHandle(__segment dhseg, DBHHANDLE dbhhnd);

DBHHANDLE __fastcall DBHFree(__segment dhseg, DBHHANDLE dbhhnd ) {

    __segment seg0;
    ARENAHDR __based(seg0) *bp0 = 0;
    __segment seg1;
    ARENAHDR __based(seg1) *bp1 = 0;
    __segment seg2;
    ARENAHDR __based(seg2) *bp2 = 0;

    seg1 = ArenaSegFromHandle( dhseg, dbhhnd);
    seg0 = (seg1 - bp1->relsegPrev);
    seg2 = (seg1 + bp1->relsegNext);
    bp0->relsegNext = seg2 - seg0;
    bp2->relsegPrev = seg2 - seg0;
    return UnlinkHandle( dhseg, dbhhnd);
}


Additional reference words: ICE 8.00 1.00
KBCategory: kbtool kbfixlist kbbuglist
KBSubcategory: CLIss
Keywords : CLIss kb16bitonly kbbuglist kbfixlist kbtool
Version : 7.00 | 1.00
Platform : MS-DOS 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 18, 1997
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.