From: Nick Craig-W. <nc...@ax...> - 2002-07-22 20:25:14
|
SDCC doesn't initialise this properly. Compile with sdcc -mmcs51 --model-large --stack-after-data -c bug1.c struct x { char a; char b[10]; }; struct x test[3] = { { 1, { 1, 2, 3, 4, 5} }, { 2, { 1 } }, { 3, { 1, 2, 3} } }; It doesn't fill the rest of the array with 0's so the structures don't have the right length if you don't completely initialise the array. __xinit__test: .db #0x01 .db #0x01 .db #0x02 .db #0x03 .db #0x04 .db #0x05 .db #0x02 .db #0x01 .db #0x03 .db #0x01 .db #0x02 .db #0x03 Which is wrong because b has length 10. -- Nick Craig-Wood nc...@ax... |