Re: [ooc-compiler] Compiler error
Brought to you by:
mva
|
From: Frank H. <hr...@te...> - 2010-07-31 02:46:59
|
It is 32-bit linux:
uname -m
i686
With the changed L__Init I get the output
List initialized
Header size: 8
Pointer size: 4
n1.sons not empty!
Changing the IsEmpty parameter to VAR settles the matter, output is now:
List initialized
I didn't do that before because I prefer program clarity over
efficiency. But as a workaround it is acceptable of course.
So: when do I need that? What is going on?
--
Frank Hrebabetzky +55 / 48 / 3235 1106
Florianopolis, Brazil
On 07/30/2010 01:30 AM, Stewart Greenhill wrote:
> Hmm... That code looks OK. At least, it matches my code which works
> fine. A few things to try:
>
> Is this possibly a 64-bit linux? Can you send me the output of:
> uname -m
>
> Try adding these lines before "return", in L__Init (obj/L.c).
> printf("Header size: %d\n", sizeof (struct L__Header));
> printf("Pointer size: %d\n", sizeof (struct L__Header *));
> Then do "oo2c -Mv Test". Rerun "Test" and it should output:
> Header size: 8
> Pointer size: 4
>
> If you add VAR to the declaration of IsEmpty does it make a difference?
> Like this:
> PROCEDURE IsEmpty* (VAR list:Header): BOOLEAN;
>
> Cheers,
> Stewart
>
> Frank Hrebabetzky wrote:
>> Hi Stewart,
>>
>> I deleted the bin, obj and sym directory and compiled with
>> oo2c --make Test
>> Same result as before. Then:
>> oo2c --version
>> oo2c/gcc 2.1.11
>> gcc --version
>> gcc (Ubuntu 4.4.3-4ubuntu5) 4.4.3
>>
>> obj/Test.c:
>> ------------------------------------------------------------
>> #include <Test.d>
>> #include <__oo2c.h>
>> #include <setjmp.h>
>>
>> void Test__NodeD_Init(Test__Node node) {
>> register OOC_INT32 i0,i1;
>>
>> i0 = (OOC_INT32)node;
>> i1 = _check_pointer(i0, 216);
>> L__Init((void*)((_check_pointer(i0, 216))+4),
>> (RT0__Struct)((OOC_INT32)&_td_L__Header));
>> i0 = L__IsEmpty((void*)((_check_pointer(i0, 244))+4));
>> i0 = !i0;
>> if (!i0) goto l4;
>> Out__String((OOC_CHAR8*)"n1.sons not empty!", 19);
>> Out__Ln();
>> l4:
>> return;
>> ;
>> }
>>
>> void OOC_Test_init(void) {
>> register OOC_INT32 i0;
>>
>> i0 = (OOC_INT32)RT0__NewObject(_td_Test__Node.baseTypes[0]);
>> Test__n1 = (Test__Node)i0;
>> Test__NodeD_Init((Test__Node)i0);
>> return;
>> ;
>> }
>>
>> void OOC_Test_destroy(void) {
>> }
>>
>> /* --- */
>> ----------------------------------------------------------
>> obj/L.c:
>> ----------------------------------------------------------
>> #include <L.d>
>> #include <__oo2c.h>
>> #include <setjmp.h>
>>
>> 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);
>> ;
>> }
>>
>> void L__Init(struct L__Header *list, RT0__Struct list__tag) {
>>
>> *(OOC_INT32*)(OOC_INT32)list = 0;
>> *(OOC_INT32*)((OOC_INT32)list+4) = 0;
>> Out__String((OOC_CHAR8*)"List initialized", 17);
>> Out__Ln();
>> return;
>> ;
>> }
>>
>> void OOC_L_init(void) {
>>
>> return;
>> ;
>> }
>>
>> void OOC_L_destroy(void) {
>> }
>>
>> /* --- */
>> --------------------------------------------------------
>>
>> I'm curious.
>
>
>
|