MASM 6.0 May Unexpectedly Initialize Every 256th Data Symbol

ID Number: Q73684

6.00 | 6.00

MS-DOS | OS/2

buglist6.00

Summary:

The Microsoft Macro Assembler (MASM) version 6.0 may incorrectly

initialize data that is intended to be uninitialized. The problem will

occur with every 256th data symbol in a module that is defined using

the "dup" operator. This may be illustrated with the sample program

below. To work around the problem, either avoid using the dup operator

when declaring a variable or limit the number of occurrences to less

than 256 per module.

More Information:

Uninitialized data is created by specifying the ? (question mark)

symbol as a value at declaration time. It is primarily used to

indicate that the initial value of a data symbol is unimportant. It

can also be used to indicate that a symbol is actually defined in a

separate compilation module and merely serves as a place holder for

this module.

If a segment contains only uninitialized data, the linker can reduce

the size of the resultant .EXE file by modifying the minalloc field in

the header by the corresponding amount. The loader will then allocate

the space at run-time and fix the addresses as required. Because the

assembler incorrectly initializes some data, the segment will not be

completely uninitialized; therefore, LINK copies the segment in its

entirety into the .EXE file and the resulting disk file is larger than

necessary.

Microsoft has confirmed this to be a problem in MASM version 6.0. We

are researching this problem and will post new information here as it

becomes available.

Sample Code

-----------

; Assemble options needed: none

mymac macro

local ldat

ldat dd 1 dup (?)

endm

data segment

REPEAT 512

mymac

endm

data ends

end