[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Tinycc-devel] bug in tcc-0.9.20
From: |
David Hovemeyer |
Subject: |
[Tinycc-devel] bug in tcc-0.9.20 |
Date: |
Fri, 24 Oct 2003 11:15:01 -0400 |
User-agent: |
Mutt/1.4.1i |
First of all, Tiny CC is a great project, so many kudos to Fabrice
and the developers.
I'm trying to compile a small operating system project (which I
developed using gcc) with Tiny CC version 0.9.20, and I think I've run
into a bug. (The same bug also appears to be in the latest CVS sources
at Savannah.) A complete test case with a Makefile is at
http://www.cs.umd.edu/~daveho/tccbug.tar.gz
Here a the code excerpt:
/**
* Global table of system call handler functions.
*/
const Syscall g_syscallTable[] = {
Sys_Null,
Sys_Exit,
Sys_PrintString,
Sys_GetKey,
Sys_SetAttr,
Sys_Spawn,
Sys_Wait,
};
/**
* Number of system calls implemented.
*/
const int g_numSyscalls = sizeof(g_syscallTable) / sizeof(Syscall);
"Syscall" is a typedef for function pointer. Sys_Null, Sys_Exit, etc.
are all static functions defined earlier in the file. When I compile
this code, I get the error
syscall.c:211: sizeof applied to an incomplete type
Line 211 is where g_numSyscalls is defined.
I poked around in tcc.c a bit, and looked at the type_size() function.
In particular, I put a printf() in the part of the code that appears
to determine the size of arrays, as follows (line 5549 of tcc.c):
} else if (bt == VT_PTR) {
if (type->t & VT_ARRAY) {
s = type->ref;
printf("s->c == %d\n", s->c);
return type_size(&s->type, a) * s->c;
This statement produces the output
s->c == -1
just before error is reported, which makes me think that tcc is
confused somehow about the number of elements in the array.
Unfortunately, I wasn't able to come up with a simple test case.
The tar file I mentioned above simply contains all of the source
and header files required to compile the file (syscall.c).
-Dave
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Tinycc-devel] bug in tcc-0.9.20,
David Hovemeyer <=