KnowledgeBase Archive

An Archive of Early Microsoft KnowledgeBase Articles

View on GitHub

Q61312: Internal Compiler Error: ‘@(#)regMD.c:1.100’, Line 3074

Article: Q61312
Product(s): See article
Version(s): 6.00   | 6.00
Operating System(s): MS-DOS | OS/2
Keyword(s): ENDUSER | buglist6.00 | mspl13_c
Last Modified: 11-JUL-1990

The program example below generates the following C1001: error when
compiled with only the following individual optimizations:

   /Oa /Oc /Oi /On /Op /Or /Os /Ot /Ow /Oz

   foo.c(24) : fatal error C1001: Internal Compiler Error
         (compiler file '@(#)regMD.c:1.100', line 3074)
         Contact Microsoft Product Support Services

Code Example
------------

typedef struct
{
   short cursize;      /* The current size of this buffer. */
   short nextscan;     /* The offset of the next scan entry.*/
} struct1;

typedef struct
{
   short len;          /* Buffer entry length */
} struct2;

void main(void)
{
   char far *cfptr1;
   char far *cfptr2;
   struct1 far *s1ptr;
   struct2 far *s2ptr;
   short    lenToMove;

   s1ptr = (struct1 far *) cfptr1;
   cfptr2 = (char far *) s2ptr + s2ptr->len;
   lenToMove = s1ptr->cursize - (short)((long)cfptr2 - (long)cfptr1);

   if ((cfptr1 + s1ptr->nextscan) >= cfptr2) // Line 24
   s1ptr->nextscan -= s2ptr->len;
}

If only the above optimizations are used to compile the program, the
internal compiler error (ICE) will occur. However, if ONE option from
the following list is added, the ICE will not occur:

 /Od /Oe /Og /Ol /Ox

In addition, the following are several other workarounds that can be
applied to the code itself:

1. Use temporary variables to hold the intermediate results before the
   "if" statement.

2. Make a function call between any of the assignment statements.

Microsoft has confirmed this to be a problem with C version 6.00. We
are researching this problem and will post new information here as it
becomes available.

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.

Copyright Microsoft Corporation 1986-2002.