ID Number: Q66924
6.00 6.00a 6.00ax | 6.00 6.00a
MS-DOS | OS/2
buglist6.00 buglist6.00a buglist6.00ax
Summary:
SYMPTOMS
When using the _based keyword to declare data, if the data is
declared externally, the .COD listing (from /Fc) and the .OBJ file
that are generated by Microsoft C versions 6.0, 6.0a, and 6.0ax may
incorrectly define the segment as class 'CODE'.
STATUS
This is a problem only with the full optimizing compiler. The quick
compiler (/qc option) works correctly.
Microsoft has confirmed this to be a problem in C versions 6.0,
6.0a, and 6.0ax. We are researching this problem and will post new
information here as it becomes available.
More Information:
The sample code below may be used to illustrate this problem. The /Fc
listing for FILE1.C declares the _based segments as follows:
STORAGE SEGMENT WORD PUBLIC 'FAR_DATA'
STORAG1 SEGMENT WORD PUBLIC 'CODE'
STORAG2 SEGMENT WORD PUBLIC 'FAR_DATA'
The .OBJ file for FILE1.C will contain a SEGDEF (SEGment DEFinition)
record defining STORAG1 as a class CODE segment. However, there is no
PUBDEF (PUBlic DEFinition) record to confuse the linker. In the .OBJ
file for FILE2.C, there is a SEGDEF record defining STORAG1 as a class
'FAR_DATA' segment, AND a PUBDEF record for the linker to resolve the
external reference of achar2 in FILE1.C. Therefore, although there
will be an extra segment (of zero length) defined in the final .EXE
file, this problem will have no detrimental effects.
If there is another variable defined in FILE1.C that is initialized
and is also based on a named segment, the invalid SEGment DEFinition
will not be generated by the compiler. The above example with the
STORAG2 segment illustrates this.
Sample Code #1
--------------
/* FILE1.C */
char _based(_segname("STORAGE")) achar1;
extern char _based(_segname("STORAG1")) achar2;
extern char _based(_segname("STORAG2")) achar3;
char _based(_segname("STORAG2")) achar4;
void main(void)
{}
Sample Code #2
--------------
/* FILE2.C */
char _based(_segname("STORAG1")) achar2;
Additional reference words: 6.00 6.00a 6.00ax