Package: tcc
Version: 0.9.26~git20120104.83d57c0-4
Severity: important

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

-- System Information:
Debian Release: wheezy/sid
  APT prefers unstable
  APT policy: (500, 'unstable'), (500, 'testing'), (500, 'stable'), (1, 
'experimental')
Architecture: amd64 (x86_64)

Kernel: Linux 3.2.0-2-amd64 (SMP w/8 CPU cores)
Locale: LANG=POSIX, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages tcc depends on:
ii  dpkg          1.16.1.2
ii  install-info  4.13a.dfsg.1-8
ii  libc6         2.13-27

Versions of packages tcc recommends:
ii  libc6-dev [libc-dev]  2.13-27

tcc suggests no packages.

-- no debconf information



-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org

Reply via email to