tinycc-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Tinycc-devel] A couple of bugs


From: Peter Wang
Subject: [Tinycc-devel] A couple of bugs
Date: Fri, 20 Jun 2003 22:23:05 +1000
User-agent: Mutt/1.4i

Hello, I think I hit a couple of bugs in tcc, but I'm not certain.
I'm using tcc 0.9.19 (and gcc 2.95.3 for the comparison).


*** Case 1 ***

$ cat sizeof-bug.c 
extern unsigned char s[];
unsigned char s[1];
int f(void) { return sizeof(s); }

$ tcc -c sizeof-bug.c 
sizeof-bug.c:3: sizeof applied to an incomplete type


*** Case 2 ***

$ cat cast-bug.c 
#include <stdio.h>

int main(void)
{
   long v[1] = { 0xdeadbeef };
   char *cp = (char *)v;
   long *lp = (long *)&cp[0];
   printf("%lx\n", *((long *)&cp[0])); /* the offending line */
   printf("%lx\n", *((long *)cp));
   printf("%lx\n", *lp);
   return 0;
}

$ tcc cast-bug.c && ./a.out
ffffffef
deadbeef
deadbeef

$ gcc cast-bug.c && ./a.out
deadbeef
deadbeef
deadbeef

-- 
王浩禎




reply via email to

[Prev in Thread] Current Thread [Next in Thread]