KnowledgeBase Archive

An Archive of Early Microsoft KnowledgeBase Articles

View on GitHub

Q66697: Compiler Incorrectly Generates 80186+ Code

Article: Q66697
Product(s): See article
Version(s): 6.00 6.00a | 6.00 6.00a
Operating System(s): MS-DOS | OS/2
Keyword(s): ENDUSER | buglist6.00 buglist6.00a | mspl13_c
Last Modified: 11-NOV-1990

The sample code below incorrectly generates the instruction "shl bx,
2" for 8086/8088 machines when compiled with the large or compact
memory model (/AL or /AC). When using an 8086/8088 machine, the only
valid second operands are cl and 1. The ability to use an immediate
value other than 1 was not available until the 80186.

Sample Code
-----------

extern int bar (double *,double *, double *, double *,
                int, int, void *, int, char, int);

void foo (double *, double *, double *, double *,
                int, int, int, int, int, int);

#define RESET 0x02

void foo (double * dPtr1, double *dPtr2, double *dPtr3,
          double * dPtr4, int i1, int i2, int i3, int i4,
          int i5, int i6)
{
   double **ldPtrPtr;

   bar(dPtr1, dPtr2, dPtr3, dPtr4, i4, i1, &ldPtrPtr[i4][i1],
       RESET, RESET, i6);
}

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.