C 5.10 Generates Incorrect AND Instruction with /G0

ID Number: Q30369

5.10 | 5.10

MS-DOS | OS/2

buglist5.10 fixlist6.00

Summary:

The C version 5.00 compiler generates an incorrect instruction when

compiling the sample program below with the /G0 switch. The generated

code contains an AND instruction (opcode 83) that is not recognized by

the 8086/80186 processors, even though the /G0 switch explicitly means

that only 8086 and 80186 instructions should be generated.

Microsoft has confirmed this to be a problem in C version 5.10. This

problem was corrected in C version 6.00.

Sample Code

-----------

typedef struct {

unsigned day : 5; /* day 1-31 */

unsigned month : 4; /* month 1-12 */

unsigned yr : 7; /* year 0-119 (1980-2099) */

} MSFDATE;

t()

{

MSFDATE date;

char *psz;

char ch;

int i;

i = date.month;

ch = psz[date.month];

}