Updated test case:

int main();

int a[] = {
 2.0 ? 0 : 1,
 (_Bool)2.0,
 !2.0,
 2.0,
 (char)500,
 main ? 0 : 1, // function pointer is always true
 (int)main + (int)1e9, // be sure the result is above 1.000.000.000
 (int)main / 2, // here must be compile-time error, tcc can compile it
 sin(1) ? 0 : 1, // here must be compile-time error, tcc can compile it
};

int main()
{
  int i;
  for(i=0; i<sizeof(a)/sizeof(*a); i++) printf("%d ", a[i]);
  printf("\n");
}



On Thu, Nov 20, 2008 at 6:54 PM, Masha Rabinovich <[EMAIL PROTECTED]
> wrote:

>
> Thank you for fast response!
>
> The test case works well now, but there is a regression:
>
> =====
>
> main()
> {
> }
>
> void* p = main;
>
> =====
>
> TCC shows a compilation error.
> On Thu, Nov 20, 2008 at 12:36 PM, Daniel Glöckner <[EMAIL PROTECTED]>wrote:
>
>> On Thu, Nov 20, 2008 at 08:50:22AM +0100, Masha Rabinovich wrote:
>> > int a = 2.0 ? 0 : 1;
>> > int b = (_Bool)2.0;
>> > int c = !2.0;
>> > int d = 2.0;
>> > int e = (char)500;
>> >
>> > int main()
>> > {
>> >   printf("%d %d %d %d %d\n", a, b, c, d, e);
>> > }
>> >
>> > GCC output: 0 1 0 2 -12
>> >
>> > TCC output: 1 0 1 0 500
>>
>> Nice example. It triggers three bugs:
>> - constants are cast only inside functions
>> - '?' does not cast to bool
>> - '!' does not cast to bool
>>
>> See http://repo.or.cz/w/tinycc/daniel.git
>>
>> The fix for the first bug needs thorough testing before it is ready for
>> inclusion.
>>
>>  Daniel
>>
>>
>> _______________________________________________
>> Tinycc-devel mailing list
>> [email protected]
>> http://lists.nongnu.org/mailman/listinfo/tinycc-devel
>>
>
>
_______________________________________________
Tinycc-devel mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/tinycc-devel

Reply via email to