FIX: Incorrect Code Generated With /Og and /G6

ID: Q216747


The information in this article applies to:
  • Microsoft Visual C++, 32-bit Professional Edition, version 6.0


SYMPTOMS

Incorrect code may be generated with the /Og and /G6 compiler optimizations.


CAUSE

The compiler incorrectly moves an .inc file, .add file, .sub file, or .lea file across an instruction that references memory.


STATUS

Microsoft has confirmed this to be a bug in the Microsoft products 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:

Q194022 INFO: Visual Studio 6.0 Service Packs, What, Where, Why

Q194295 HOWTO: Tell That Visual Studio 6.0 Service Packs Are Installed


MORE INFORMATION

The following code illustrates one way the compiler can handle moving an instruction:


   inc eax
   mov [eax + 2*ebx + 3] 
The compiler needs to update the displacement to swap the instructions. For example:

   mov [eax + 2*ebx + (3 + 1)]
   inc eax 

Additional query words:

Keywords : kbservicepack kbVC600 kbVS600sp2 kbVS600SP1 kbVS600sp3fix
Version : winnt:6.0
Platform : winnt
Issue type : kbbug


Last Reviewed: May 19, 1999
© 2000 Microsoft Corporation. All rights reserved. Terms of Use.