This is the mail archive of the
cygwin
mailing list for the Cygwin project.
RE: gcc bug
On 21 November 2007 15:30, Samuel Thibault wrote:
> Dave Korn, le Wed 21 Nov 2007 15:22:15 -0000, a écrit :
>> On 21 November 2007 15:02, Samuel Thibault wrote:
>>
>>> Can someone test http://dept-info.labri.fr/~thibault/tmp/test.c ?
>> Yep, the URL works fine.
>> Perhaps you'd like to expand on that request?
>
> Yes: please run make test and ./test
Yeh, I knew you meant that really. Odd. Is there something we're
forgetting about size-vs-sign preservation in size extension going on here?
/win/t/artimi/chips/earn/block/rom/.save $ cat test.c
#include <stdlib.h>
#include <stdio.h>
int main( void )
{
int i=2;
int x, y;
if( (-10*abs (i-1)) == (10*abs(i-1)) )
printf ("OMG,-10==10! %d %d\n", (-10*abs (i-1)), (10*abs(i-1)));
else
printf ("nothing special here\n") ;
printf ("%d * %d = %d\n", (-10), (abs (i-1)), (-10*abs (i-1)));
printf ("%d * %d = %d\n", (-10), ((int)abs (i-1)), (-10*(int)abs (i-1)));
printf ("%d * %d = %d\n", (-10), (1), (-10*(int)1));
printf ("??? %d == %d ? %d\n", (-10*(int)abs (i-1)), (-10*(int)1),
(-10*(int)a
bs (i-1)) == (-10*(int)1));
x = (-10);
y = (abs (i-1));
printf ("x, y = %d, %d - prod %d\n", x, y, x * y);
return 0 ;
}
@_______. .
( /"\
||--||(___)
'" '"'---'
/win/t/artimi/chips/earn/block/rom/.save $ gcc -g -O0 test.c -o test
--save-tem
ps
@_______. .
( /"\
||--||(___)
'" '"'---'
/win/t/artimi/chips/earn/block/rom/.save $ ./test.exe
OMG,-10==10! 10 10
-10 * 1 = 10
-10 * 1 = 10
-10 * 1 = -10
??? 10 == -10 ? 0
x, y = -10, 1 - prod -10
@_______. .
( /"\
||--||(___)
'" '"'---'
/win/t/artimi/chips/earn/block/rom/.save $
cheers,
DaveK
--
Can't think of a witty .sigline today....
--
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Problem reports: http://cygwin.com/problems.html
Documentation: http://cygwin.com/docs.html
FAQ: http://cygwin.com/faq/