Microsoft KB Archive/30566

Logical AND Fails in Argument List PSS ID Number: Q30566 Article last modified on 05-23-1988 PSS database name: S_QuickC

1.01

MS-DOS

Summary: The program below will not produce the correct results when compiled with the following command line:

qcl /Ot /AL prog.c

If you use /Zi and look at the code generated for the third line from main, you will see that for the second argument, AX is loaded with d->flags(0x12), ANDed with 0x02, and then PUSHed. However, for the second argument, AX is not reloaded with d->flags before it is ANDed with 0x02. This sets AX to 0x00 rather than 0x10, and this is the value that is PUSHed. Microsoft is researching this problem and will post new information as it becomes available.

More Information:


 * 1) include 

void main (void); void test (int, int);

struct tag *d;

struct tag { int flags; } f;

void main (void) { d = &f; d->flags = 0x12; test (d->flags & 0x10, d->flags & 0x02); };

void test (a, b) int a, b; { printf (“12H & 10H = %xH 12H & 02H = %xH”, a, b); }

Copyright Microsoft Corporation 1988.