Q51708: /Ot Generates Incorrect Code on JMP SHORT $+2
Article: Q51708
Product(s): See article
Version(s): 2.00 2.01
Operating System(s): MS-DOS
Keyword(s): ENDUSER | buglist2.00 buglist2.01 s_quickasm | mspl13_c
Last Modified: 17-JAN-1990
In the example below, with the following compile options
/AS /G2 /Ot /Zp2
a reference to the "$" (current location counter) symbol from within
the scope of an _asm directive results in an incorrect assignment.
This problem occurs with QuickC Versions 2.00 and 2.01.
With any optimization switch other than /Ot, the short jump is
correctly resolved to $+2. With /Ot, the short jump is incorrectly
resolved to _main+2.
To work around the problem, compile and link separately. Compile with
/Zi (embedding CodeView information, thus altering the code
generation) and link without /CO (so that the CodeView information is
not passed to the .EXE file).
Microsoft has confirmed this to be a problem with QuickC Versions 2.00
and 2.01. We are researching this problem and will post new
information here as it becomes available.
The following example demonstrates the problem:
main()
{
_asm
{
MOV DX, 0x21
IN AL, DX
JMP SHORT $+2
OR AL, 0x10
OUT DX, AL
}
}
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.