tinycc-devel
[Top][All Lists]
Advanced

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

Re: [Tinycc-devel] tcc 0.9.21: wrong code generated for casts


From: Zhonglin Zhang
Subject: Re: [Tinycc-devel] tcc 0.9.21: wrong code generated for casts
Date: Thu, 28 Oct 2004 21:49:27 +0800

Hi, how should i use 'arm-lcc' ?

Here are the wrong results !

#arm-tcc t1.c -o t3
/usr/lib/crt1.o: invalid object file
/usr/lib/crti.o: invalid object file
/lib/libc.so.6: bad architecture
/usr/lib/crtn.o: invalid object file
tcc: undefined symbol 'printf'


在2004年10月28日的21:05,Bruno Haible写道:
> /* Hi, this file exposes bugs in tcc-0.9.21. It prints 0 0 0 0 while the
>    correct result is 1 1 1 1. */
> 
> #include <stdbool.h>
> #include <stdio.h>
> 
> bool uint_char (char *p) {
>   return (char)(unsigned int)*p == *p;
> }
> 
> bool ulong_char (char *p) {
>   return (char)(unsigned long)*p == *p;
> }
> 
> bool uint_short (short *p) {
>   return (short)(unsigned int)*p == *p;
> }
> 
> bool ulong_short (short *p) {
>   return (short)(unsigned long)*p == *p;
> }
> 
> int main ()
> {
>   char x = -3;
>   short y = -5;
> 
>   printf ("%d %d %d %d\n",
>           uint_char (&x), ulong_char (&x), uint_short (&y), ulong_short (&y));
>   return 0;
> }
> 
> 
> 
> _______________________________________________
> Tinycc-devel mailing list
> address@hidden
> http://lists.nongnu.org/mailman/listinfo/tinycc-devel





reply via email to

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