[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Tinycc-devel] Can't compile the eiffel generated C files
From: |
Dave Dodge |
Subject: |
Re: [Tinycc-devel] Can't compile the eiffel generated C files |
Date: |
Thu, 28 Jul 2005 17:29:11 -0400 |
User-agent: |
Mutt/1.4.2i |
On Wed, Jul 27, 2005 at 11:56:53PM +0700, Lothar Scholz wrote:
> I really want to use TinyCC with SmartEiffel but i get 3
> different errors in some of the C files.
> arachno_ruby143.c:6793: memory full
This is caused by tcc overflowing its internal stack. Look in tcc.c for:
#define VSTACK_SIZE 256
Change the 256 to a higher value and rebuild tcc. I tried 2560 and it
managed to compile the file.
> arachno_ruby156.c:679: cannot use pointers here
It looks like a SmartEiffel problem. Here's the line of code:
R=(((T6)((/*RF2*/(((T382*)C))->_second/*4*/))))
"R" is a char. "T6" is type char. "_second" is a struct pointer.
It's casting a struct pointer value to a char value. That is at best
implementation-defined and at worst undefined. It's basically the
same as:
struct foo * x;
char y = (char)x;
Which is obviously non-portable C code. gcc will complain about it if
you turn up the warning level:
arachno_ruby156.c:679: warning: cast from pointer to integer of different size
arachno_ruby156.c:685: warning: cast from pointer to integer of different size
Fixing this safely will require understanding why SmartEiffel is doing
this unusual cast. If you just want to force tcc to take it, you
could try casting to a larger integer type first; it may or may not
produce the same results as some other compiler:
R=(((T6)(unsigned long)((/*RF2*/(((T382*)C))->_second/*4*/))))
> arachno_ruby119.c:2347: cannot cast 'struct S1763 *' to 'struct S0 *'
It looks like a SmartEiffel problem. Here's the statement:
call_e2r0e6v(&ds,vc(a2,1017183770),_b,C,1);
T0 is struct {int id; }
T1763 is struct {int id; plus some other stuff }
C is a pointer to a T1763.
The function expects a pointer to a T0.
This requires a cast. For example:
call_e2r0e6v(&ds,vc(a2,1017183770),_b,(T0*)C,1);
When a function is called using a prototype, the implicit argument
conversions are done with the same rules as assignment. An assignment
of a structure pointer requires that the structures be compatible.
Structure compatibility requires all fields to match. This is
essentially the same problem as:
struct x { int a; };
struct y { int a; int b; };
struct x foo;
struct y * bar;
bar = &foo; /* cast needed */
Again, gcc will tell you there is a problem if you turn up the warnings:
arachno_ruby119.c:2347: warning: passing arg 4 of `call_e2r0e6v' from
incompatible pointer type
-Dave Dodge