C1001: Internal Compiler Error: regMD.c, Line 1017

ID Number: Q61918

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 for small

(/AS) or medium (/AM) memory model with global register allocation

(/Oe) optimization:

file.c(19) : fatal error C1001: Internal Compiler Error

(compiler file '@(#)regMD.c:1.100', line 1017)

Contact Microsoft Product Support Services

Microsoft has confirmed this to be a problem in C version 6.0. This

problem was corrected in C version 6.0a.

The following workarounds may be used to eliminate this error in C

version 6.0:

1. Do not compile with the /Oe switch.

-or-

2. Use the optimize pragma to disable the /Oe optimization for this

particular routine. Above the routine func, add the following line:

#pragma optimize ("e", off)

After the closing curly bracket of func, you can turn the

optimization back on with the following:

#pragma optimize ("e", on)

-or-

3. Use a temporary variable for the return value of malloc, as

follows:

unsigned offset ;

offset = (unsigned) malloc (pdata->usize) ;

FP_OFF (buffer) = pdata->offset = offset ;

Sample Code

-----------

/* Compile options needed: /AS /Oe

*/

#include <dos.h>

#include <malloc.h>

typedef struct {

unsigned offset ;

unsigned usize ;

} struct1 ;

void func(unsigned handle, struct1 *pdata)

{

unsigned char far *buffer ;

unsigned numbytes ;

FP_OFF (buffer) = pdata->offset = (unsigned) malloc (pdata->usize) ;

_dos_read (handle, buffer, (unsigned) pdata->usize, &numbytes) ;

}