-
Bug
-
Resolution: Unresolved
-
Medium
-
Code Generation Tools
-
CODEGEN-9407
-
-
-
-
default
The attached file.c has these lines ...
typedef struct { unsigned a; unsigned b; } entry_t; typedef struct { unsigned len; entry_t entries[]; } array_t; const array_t array = { .len = 3, .entries = { { .a = 1,}, { .a = 2}, { .a = 3}, }, };
Build it ...
% cl2000 -s file.c
Inspect the resulting assembly file ...
_array: .bits 0x3,16 ; _array._len @ 0 .bits 0x1,16 ; _array[0]._a @ 16 .space 16 .bits 0x2,16 ; _array[1]._a @ 48 .space 16 .bits 0x3,16 ; _array[2]._a @ 80
There should be one more line of ".space 16", so that array[3].b is set to 0. Instead it ends up having the value of whatever is next in memory.