looks like the sign doesn't get properly extended when going from 8 bits to
32 bits???
-Alessandro
On Mon, Aug 18, 2008 at 12:07, John Regehr <[EMAIL PROTECTED]> wrote:
> Sorry, I mean it prints "-255".
>
> I'm using tcc-0.9.24 on Ubnutu Linux.
>
> John Regehr
>
>
>
>
> John Regehr wrote:
>
>> For the program below, tcc emits a program that prints "255" whereas most
>> compilers would say that the program should print "1".
>>
>> Of course wrapping the signed scalar p_99 has undefined behavior, so what
>> I am asking is: is tcc intentionally exploiting the undefinedness of the
>> program, or is this a bug?
>>
>> Thanks,
>>
>> John Regehr
>>
>>
>>
>> #include <stdio.h>
>>
>> int g_254;
>>
>> void func_97 (signed char p_99);
>> void func_97 (signed char p_99)
>> {
>> for (; p_99; p_99 -= 1)
>> g_254 = p_99;
>> }
>>
>> int
>> main (void)
>> {
>> func_97 (-1);
>> printf ("%d\n", g_254);
>> return 0;
>> }
>>
>>
>> _______________________________________________
>> 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
>
--
A hammer is best when your problem is a nail, and a screwdriver is best when
your problem is a screw.
A l e s s a n d r o
S a l v a t o r i
_______________________________________________
Tinycc-devel mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/tinycc-devel