bartz@elbereth.rutgers.edu (Bartz) (04/20/88)
I resently found what I believe to be a bug in Manx C 3.6a. The
following example program illustrates the problem.
typedef struct test_type
{
int v1,v2,v3;
} test_type;
test_type atest[66][198];
This program simply defines a struct type which is 6 bytes in length,
and then declares a large array of this type. The resulting memory block
should be 6 x 66 x 198 bytes long (or 78408 bytes). The example is then
compiled with the far code/far data switchs, as well as the switches
to not run the assembler and comment the assembly code with C statements
(ie. cc +C +D -A -T -o test.asm test.c).
The resulting test.asm file is:
;:ts=8
far code
far data
;typedef struct test_type
;{
; int v1,v2,v3;
;} test_type;
;
;test_type atest[66][198];
global _atest,12872 <------- Note the size in bytes......
public .begin
dseg
end
The size of the memory block is 78408 truncated to 16 bits (ie.
12872). This seems to be a bug. Even correcting the problem in the
assembly code (in my real program, note the example) dosen't seem to work
right since although the array APPEARS!!!! to be the proper size, strange
errors occur, in different places every time I compile the exact same
program.
Ed Bartz
--
ARPA: Bartz@ruthep.rutgers.edu UUCP: bartz@elbereth.uucp
BITNET: bartz@ruthep.bitnet