Re: [ooc-compiler] Compiler error
Brought to you by:
mva
|
From: Riza D. <rd...@ya...> - 2010-08-03 07:39:04
|
Hi Frank,
Sorry for the delay, but here is what I think...
/* The working version */
OOC_CHAR8 L__IsEmpty(struct L__Header *list, RT0__Struct list__tag) {
register OOC_INT32 i0;
i0 = (OOC_INT32)*(OOC_INT32*)(OOC_INT32)list;
return (i0==0);
;
}
/* The not working version */
OOC_CHAR8 L__IsEmpty(const struct L__Header *list__ref) {
register OOC_INT32 i0;
OOC_ALLOCATE_VPAR(list,L__Header ,1)
OOC_INITIALIZE_VPAR(list__ref,list,L__Header ,8)
i0 = (OOC_INT32)*(OOC_INT32*)(OOC_INT32)list;
return (i0==0);
;
}
The generated code for L__IsEmpty is almost identical. If you remove
the OOC_ALLOCATE_VPAR and OOC_INITIALIZE_VPAR and change the list
by casting it to a (struct L__Header*) it should work. I arrived at
this conclusion, because the list__tag in the working code is
not used at all.
So what we could do to pinpoint the problem (I think) is change in the
non working code the L__IsEmpty function as shown below and run the test
again. (I assume that the generated C code can be changed and compiled)
The C compiler might issue warnings, but should compile (If I made no
mistakes).
OOC_CHAR8 L__IsEmpty(const struct L__Header *list__ref) {
register OOC_INT32 i0;
/*OOC_ALLOCATE_VPAR(list,L__Header ,1)*/
/*OOC_INITIALIZE_VPAR(list__ref,list,L__Header ,8)*/
struct L__Header *list = (struct L__Header *)list__ref;
i0 = (OOC_INT32)*(OOC_INT32*)(OOC_INT32)list;
return (i0==0);
;
}
What I suspect is that the initialization/copying done by the
OOC_INITIALIZE_VPAR, OOC_ALLOCATE_VPAR pair is not correct.
If the above code works, then the problem would be in those
OOC_* calls (they might be macros).
If you would not mind, could you please do this change and
test?
Kind Regards,
Riza
|