Microsoft KB Archive/115524

{|
 * width="100%"|

BUG: C1001: Internal Compiler Error, File main.c

 * }

Q115524

-

The information in this article applies to:


 * The C/C++ Compiler (CL.EXE), included with:
 * Microsoft C/C++ for MS-DOS, version 7.0
 * Microsoft Visual C++, versions 1.0, 1.5

-

SYMPTOMS
The use of time optimization on a source file containing an inline assembly jump to code outside the assembly block may generate an internal compiler error, as demonstrated in the sample code below:

Under C/C++, version 7.0, the following error is generated:

  test.c(15) : fatal error C1001: INTERNAL COMPILER ERROR (compiler file '@(#)main.c:1.27', line 826) Contact Microsoft Product Support Services

With the C/C++ compiler version 8.0, a similar error is generated:

  test.c(15) : fatal error C1001: internal compiler error (compiler file '@(#)main.c:1.27', line 831)

C/C++, version 8.0c, generates the same error, except with a different line number:

  test.c(15) : fatal error C1001: internal compiler error (compiler file '@(#)main.c:1.27', line 841)

RESOLUTION
There are two workarounds to this problem:

 Use the fast compiler option, /f.  Disable optimization during the function where the error occurs by using the optimize pragma:         #pragma optimize("",off) void bad_function(void) {           /* ... */          }

#pragma optimize("",on) 

STATUS
Microsoft has confirmed this to be a bug in the products listed above. We are researching the problem and will post new information here in the Microsoft Knowledge Base as it becomes available.

This problem does not occur using C/C++, version 8.0, included with Visual C++, 32-bit Edition, version 1.0.

MORE INFORMATION
The following sample code can be used to demonstrate this problem:

Sample Code
/* Compile options needed: /c /Ot int validate_Float( float nf ) {        __asm {           finit fld nf           ftst fnstsw ax           finit and ax, 0x0400 jz point }        return 0; point: return 1; }

void main {        float f = 1; validate_Float( f ); } Additional query words: 1.00 1.50 7.00 8.00 8.00c

Keywords : kb16bitonly

Issue type : kbbug

Technology : kbVCsearch kbAudDeveloper kbCVCComp