ID Number: Q61055
6.00 | 6.00
MS-DOS | OS/2
buglist6.00 fixlist6.00a
Summary:
The Microsoft C Compiler version 6.0 produces the following internal
compiler error when the sample program below is compiled with /Ole
optimization:
file.c(18) : fatal error C1001: Internal Compiler Error
(Compiler file '@(#)regMD.c:1.100', line 1017
Contact Microsoft Product Support Services
More Information:
To work around this problem, disable either the global register
allocation /Oe or the loop optimization /Ol. There is a conflict with
both optimizations being enabled at the same time with this particular
code.
The following are two additional workarounds:
1. Use the optimize() pragma to override the compiler's optimization
switch (as shown in the comments in the sample code).
You can disable one of the optimizations before the function that
contains the offending statement, and then re-enable the
optimization after the closing curly brace (}) of the function.
With this method, you gain the optimum performance available for
your source code.
2. Instead of -Ole, use just -Ol or -Oe (not both).
Microsoft has confirmed this to be a problem with Microsoft C version
6.0. This problem was corrected in C version 6.0a.
Sample Code
-----------
/* Compile options needed: /Ole
*/
void func(unsigned);
/* Either of the following two pragmas are valid workarounds. */
/* #pragma optimize ("l", off) */
/* #pragma optimize ("e", off) */
void func(unsigned start)
{ /* Works if "start" is an "int" instead of "unsigned" */
int i;
int end;
end = start + 8; /* Works if "end = start" or if
"end" is assigned to a constant */
for (i = start; i < end; ++i)
end++; /* Works if empty statement or i++ */
}
/* #pragma optimize ("l", on) */
/* #pragma optimize ("e", on) */
Additional reference words: 6.00 6.00a