PRB: Bad Conditional Jump Generated in Inline Assembly

ID Number: Q69011

6.00 6.00a 6.00ax | 6.00 6.00a

MS-DOS | OS/2

buglist6.00 buglist6.00a buglist6.00ax fixlist7.00

Summary:

SYMPTOMS

The Microsoft C Compiler versions 6.0, 6.0a, and 6.0ax will

generate bad code for conditional jumps in inline assembly blocks

under certain conditions. If, prior to the conditional jump, an

align or even directive is used that causes NOP instructions to be

inserted into the code, the conditional jump address will be off by

the number of NOPs inserted into the code. This problem occurs only

when using the /Od switch for disabling optimizations on the

compile.

RESOLUTION

Compiling with /Os, /Ot, or /Ox will resolve the problem. Removing

any align or even directives will also eliminate the source of the

problem. Finally, using the /qc (quick compile) option will also

generate correct code; however, the /qc option does not generate

the NOP instructions for the align and even directives as it

should.

STATUS

Microsoft has confirmed this to be a problem in C versions 6.0,

6.0a, and 6.0ax. This problem was corrected in C/C++ version 7.0.

More Information:

Sample Code

-----------

/* Compile options needed: /Od

*/

void main (void)

{

_asm

{

even

push ds

even

jb a1

a1: pop ds

}

}

Additional reference words: 6.00 6.00a 6.00ax