KnowledgeBase Archive

An Archive of Early Microsoft KnowledgeBase Articles

View on GitHub

Q46379: C 5.10 Internal Compiler Error C1001: pgoMD.c : 1.134 Line 146

Article: Q46379
Product(s): See article
Version(s): 5.10   | 5.10
Operating System(s): MS-DOS | OS/2
Keyword(s): ENDUSER | | mspl13_c
Last Modified: 25-JUL-1989

Using a structure as the conditional argument of a ternary expression
causes an internal compiler error if the structure contains three or
more elements. The following error message is displayed:

   struct.c(15) : fatal error C1001: Internal Compiler Error
             (compiler file '@(#)pgoMD.c:1.134', line 1467)
             Contact Microsoft Technical Support

The ternary operator, as defined in the Microsoft C Version 5.10
user's guide, accepts three operands. The conditional operand is
required by Microsoft C to be of type integral, float, or pointer. Any
other type (including struct) is undefined.

If the structure contains less than three elements, no error is
produced but the code will be undefined.

To work around the problem, use an if statement with appropriate
assignments rather than the conditional operator.

The following program produces the internal compiler error:

#include <stdio.h>
struct { int a;
         int b;
         int c; } s;
void main(void)
{
  printf("the value %d\n", s ? 1 : 2);
}

Microsoft is researching this problem and will post new information as
it becomes available.

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.

Copyright Microsoft Corporation 1986-2002.