Home/Support/Support Forum/Bad recognizing of structs size ??
Welcome to Digi Forum, where you can ask questions and receive answers from other members of the community.

Bad recognizing of structs size ??

0 votes
Using the DC 10.70 (and 10.72) I notice this problem to compiling targetless (my board is RCM4310) :

The compilation doesn't ends and no error is detected! (error window is empty and the map file is incomplete!)

this is the code:

typedef struct {
byte a[100];
} str1;
bbram far str1 mystr1;

typedef struct {
uint16 x;
uint16 y;
str1 z[400];
} str2;
bbram far str2 mystr2;


#define array_size sizeof(mystr2) // number of bytes in array

main () {
printf("\n");
//printf("%d", array_size);
printf("\n");
}


map file:


// Function mapping and source reference.
// * The size of labels is indeterminate and so is denoted with an asterisk.
// Addr Size Function File Line Num


// Global/static data symbol mapping and source reference.
// Addr Size Symbol File Line Num Type
b3c3 4 dkSendChar \DKCORE.LIB 2605 struct __dksendchar
b3b7 12 sxd \RS232.LIB 479 struct _sxd *[]
00f9:ef9c 100 mystr1 \UNTITLED1.C 4 __far struct mystr1

// Parameter and local auto symbol mapping and source reference.
//Offset Rel. to Size Symbol File Line Num Type


// Macro listing and source reference.
// Name File Line Num
_RESTRICT_WATCHCODE_
SETUSERMODE \DEFAULT.H 14
SETSYSMODE \DEFAULT.H 15
_system \DEFAULT.H 16
_SYS_CALL_VARS \DEFAULT.H 17
.........

Anydody can explain me what'is happening??
asked Aug 6, 2013 in Rabbit Software by FabioPD New to the Community (5 points)

Please log in or register to answer this question.

1 Answer

0 votes
The limit on the size of a struct is 32K and your str2 is 40004 bytes in size. The compiler seems to not give an error message for this and just stops. If you reduce the [400] in your example to 100 for example the code compiles correctly.

Regards,
Peter
answered Aug 6, 2013 by petermcs Veteran of the Digi Community (1,128 points)
Thanks petermcs
I'm cheer up that is only a compile problem of sizeof() function  and now I can continue with my big structs but I prefer have an compiler error...

I Imagine that if I use the last  bytes of mystr2 the pointer can overwrite unknow mem areas...

How can I reprot this heavy bug to Idigi developers?
You can do it at http://www.digi.com/login?ReturnUrl=%2fsupport%2feservice%2f or you can probably send an email to support@digi.com
...