C 5.10 May Generate Incorrect EVEN Directives in Assembly List

ID Number: Q30490

5.10

MS-DOS

buglist5.10 fixlist6.00

Summary:

The C 5.10 compiler may generate, under certain circumstances, an

incorrect assembly listing as illustrated in the following example. In

this case, the assembly code that is generated will cause variables to

overlap because of an incorrect combination of the ORG and EVEN

directives.

Sample Code

-----------

void main(void)

{

unsigned char sid;

static unsigned char near ph_recl;

static unsigned char near ph_recl_rem;

static short temp_rem;

}

More Information:

The above code, when compiled with the /Fa or /Fc option, will

generate the following assembly language code:

_BSS SEGMENT

ORG $+4

$S103_ph_recl DB 01H DUP (?)

EVEN

ORG $-5

$S104_ph_recl_rem DB 01H DUP (?)

EVEN

ORG $+1

$S105_temp_rem DW 01H DUP (?)

Because of the EVEN directives, the data of ph_recl and temp_rem

overlaps. You can work around the problem by removing the EVEN

directives and assembling that code.

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

problem was corrected in C version 6.00.