BUG: C1001: Internal Compiler Error: pgoMD2.c, Line 681

Last reviewed: July 22, 1997
Article ID: Q115526
1.00 1.50 WINDOWS kbtool kbbuglist

The information in this article applies to:

  • The Microsoft C/C++ Compiler (CL.EXE), included with:

        - Microsoft Visual C++ for Windows, versions 1.0 and 1.5
    

SYMPTOMS

Compiling the sample code shown below using the /Ot, /Ob2, or /Gr options causes the optimizing compiler to generate the following error:

    fatal error C1001: internal compiler error
    (compiler file '@(#)pgoMD2.c:1.23', line 681)

Compiling the sample code with the switches listed above also causes the compiler to generate the following warning:

    warning C4124: __fastcall with stack checking is inefficient

However, compiling the code with /Gs to turn off stack checking does not avoid the C1001 error.

RESOLUTION

To avoid the problem, do one of the following:

  • Do not use one of the /Ot, /Ob2, or /Gr options. Removing any one of these options allows the code to compile successfully. The options can be removed at the module level by not specifying them on the compile command line. They can also be removed at the function level by using #pragma optimize directives in the source code. The sample code shown below illustrates this technique.

    -or-

  • Use the fast compiler because the problem only occurs with the optimizing compiler. Use of the fast compiler can be forced with the /f compiler switch.

STATUS

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

This is not a problem in Visual C++, 32-bit Edition.

MORE INFORMATION

Sample Code

/* Compile options needed: /Otb2 /Gr
*/
      #include <stdio.h>

      int main(void);

      int fail_count = 0;

      void fail(int line)
      {
          printf("failed line %d\n",line);
          fail_count++;
      }

      void checke (int a, int b)
      {
          if (a != b)
              printf ("Not equal\n");
      }

      typedef int (*func_ptr_elip_arg)(...);
      typedef int (*func_ptr_uint_arg)(unsigned);

      int f(unsigned);

      int g(func_ptr_elip_arg p)
      {
          return p(1);
      }

      int g(func_ptr_uint_arg p)
      {
          return p(2);
      }

      int f(unsigned u)
      {
          return u * 4;
      }

      // Uncomment the following pragma to allow this to compile
      //#pragma optimize ( "", off )

      int main(void)
      {
          checke(g((int(*)(...))&f),4);

          if(!fail_count)
              printf("passed\n");

          return fail_count;
      }


Additional reference words: 1.00 1.50 8.00 8.00c
KBCategory: kbtool kbbuglist
KBSubcategory: CLIss
Keywords : kb16bitonly


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.

Last reviewed: July 22, 1997
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.