Article ID: 216747 - View products that this article applies to.
This article was previously published under Q216747
This article has been archived. It is offered "as is" and will no longer be updated.
Incorrect code may be generated with the /Og and /G6 compiler optimizations.
The compiler incorrectly moves an .inc file, .add file, .sub file, or .lea file across an instruction that references memory.
Microsoft has confirmed that this is a bug in the Microsoft products that are listed at the beginning of this article.
This bug was corrected in Visual Studio 6.0 Service Pack 3. For more information about Visual Studio service packs, please see the following articles in the Microsoft Knowledge Base:
(https://support.microsoft.com/kb/194022/EN-US/ )INFO: Visual Studio 6.0 Service Packs, What, Where, Why
(https://support.microsoft.com/kb/194295/EN-US/ )HOWTO: Tell That Visual Studio 6.0 Service Packs Are Installed
The following code illustrates one way the compiler can handle moving an instruction:
The compiler needs to update the displacement to swap the instructions. For example: