I've found the following bug when compiling and testing MPFR with
Debian's tcc 0.9.26~git20120104.83d57c0-4 package.
On x86_64 (but not on i386), the left shift is buggy:
#include <stdio.h>
#include <limits.h>
#define SH (CHAR_BIT * sizeof(unsigned long) / 2)
int main (void)
{
unsigned long m;
int sh = SH;
printf ("SH = %d\n", (int) SH);
m = 1UL << SH;
printf ("m = 0x%lx\n", m);
m = 1UL << sh;
printf ("m = 0x%lx\n", m);
m = 1UL << (SH/2);
m *= m;
printf ("m = 0x%lx\n", m);
return 0;
}
gives:
SH = 32
m = 0x0
m = 0x1
m = 0x100000000
The correct result (as obtained with gcc) is:
SH = 32
m = 0x100000000
m = 0x100000000
m = 0x100000000
I've also reported it on the Debian BTS:
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=663711
--
Vincent Lefèvre <[email protected]> - Web: <http://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <http://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)
_______________________________________________
Tinycc-devel mailing list
[email protected]
https://lists.nongnu.org/mailman/listinfo/tinycc-devel