ID Number: Q71755
6.00 6.00a 6.00ax | 6.00 6.00a
MS-DOS | OS/2
buglist6.00 buglist6.00a buglist6.00ax fixlist7.00
Summary:
SYMPTOMS
The Microsoft C Compiler versions 6.0, 6.0a, and 6.0ax produce the
following internal compiler errors when the sample program below is
compiled with optimization (except for /Og):
With C 6.0a
------------
file.c(23) : fatal error C1001: Internal Compiler Error
(compiler file '@(#)regMD.c:1.110', line 3047)
Contact Microsoft Product Support Services
With C 6.0
-----------
file.c(23) : fatal error C1001: Internal Compiler Error
(compiler file '@(#)regMD.c:1.110', line 3020)
Contact Microsoft Product Support Services
C 6.0a produces the error with default optimization or any
optimization option except /Od, /Oe, /Og, /Ol, or /Ox. C 6.0
produces the error with default optimization or any optimization
option except /Od, /Og, or /Ox.
RESOLUTION
The following are valid workarounds for this problem:
1. Compile with /Og (global register allocation) in addition to any
other optimization.
-or-
2. Compile with the quick compile (/qc) option.
-or-
3. Use the optimize pragma to turn off the problem optimizations
for the function. This is shown in the sample code below.
STATUS
Microsoft has confirmed this to be a problem in C versions 6.0,
6.0a, and 6.0ax. This problem was corrected in C version 7.0.
More Information:
Sample Code
-----------
/* Compile options needed: /Ot (or almost any other optimization)
*/
/* Uncomment #pragma lines for workaround */
#include <stdio.h>
#include <malloc.h>
// #pragma optimize("t",off)
void main(void)
{
char _huge *test;
if ( (test=halloc(32800,sizeof(char))) == NULL)
printf("Error allocating memory.\n");
else
{
*test = 'a';
test += 32768;
}
}
// #pragma optimize("t",on)
Additional reference words: 6.00 6.00a 6.00ax