Bug#524472: gcc-4.3: gcc 4.3.2 miscompiles GMP 4.3.0

2009-04-21 Thread Vincent Lefevre
retitle 524472 [PR tree-optimization/36765] gcc-4.3: gcc 4.3.2 strict-aliasing 
bug / miscompiles GMP 4.3.0
thanks

I've added the upstream bug reference to the title, in case
someone else wonders...

-- 
Vincent Lefèvre vinc...@vinc17.org - Web: http://www.vinc17.org/
100% accessible validated (X)HTML - Blog: http://www.vinc17.org/blog/
Work: CR INRIA - computer arithmetic / Arenaire project (LIP, ENS-Lyon)



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



Bug#524472: gcc-4.3: gcc 4.3.2 miscompiles GMP 4.3.0

2009-04-17 Thread Vincent Lefevre
Package: gcc-4.3
Version: 4.3.2-1.1
Severity: important
Tags: lenny

When I build GMP 4.3.0 with gcc 4.3.2, I get the following errors in
make check:

rootrem.c:338: GNU MP assertion failed: bn = qn
/bin/sh: line 4:  2231 Aborted (core dumped) ${dir}$tst
FAIL: reuse
rootrem.c:338: GNU MP assertion failed: bn = qn
/bin/sh: line 4:  2256 Aborted (core dumped) ${dir}$tst
FAIL: t-root

This is a known bug in GCC 4.3.2 (I don't have any reference for the
moment, but I can ask for more information), that has been fixed in
GCC 4.3.3. I wonder if the patch can be backported to lenny, as such
bugs (compiler bugs which silently lead to incorrect code) can have
nasty effects on software the user or administrator has compiled:
incorrect results, erratic behavior...

-- System Information:
Debian Release: 5.0.1
  APT prefers stable
  APT policy: (500, 'stable')
Architecture: amd64 (x86_64)

Kernel: Linux 2.6.26-1-amd64 (SMP w/1 CPU core)
Locale: LANG=POSIX, LC_CTYPE=en_US.ISO8859-1 (charmap=ISO-8859-1)
Shell: /bin/sh linked to /bin/bash

Versions of packages gcc-4.3 depends on:
ii  binutils2.18.1~cvs20080103-7 The GNU assembler, linker and bina
ii  cpp-4.3 4.3.2-1.1The GNU C preprocessor
ii  gcc-4.3-base4.3.2-1.1The GNU Compiler Collection (base 
ii  libc6   2.7-18   GNU C Library: Shared libraries
ii  libgcc1 1:4.3.2-1.1  GCC support library
ii  libgomp14.3.2-1.1GCC OpenMP (GOMP) support library

Versions of packages gcc-4.3 recommends:
ii  libc6-dev 2.7-18 GNU C Library: Development Librari

Versions of packages gcc-4.3 suggests:
pn  gcc-4.3-doc   none (no description available)
pn  gcc-4.3-locales   none (no description available)
ii  gcc-4.3-multilib  4.3.2-1.1  The GNU C compiler (multilib files
pn  libgcc1-dbg   none (no description available)
pn  libgomp1-dbg  none (no description available)
pn  libmudflap0-4.3-dev   none (no description available)
pn  libmudflap0-dbg   none (no description available)

-- no debconf information



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



Bug#524472: gcc-4.3: gcc 4.3.2 miscompiles GMP 4.3.0

2009-04-17 Thread Vincent Lefevre
retitle 524472 gcc-4.3: gcc 4.3.2 strict-aliasing bug / miscompiles GMP 4.3.0
thanks

I've tracked down the bug and managed to write a simple testcase:

/* With GCC 4.3.2 and -O2 option: output value is 1 instead of 0.
 * If -fno-strict-aliasing is added, this bug disappears.
 */

#include stdio.h
#include stdlib.h

int test (int n)
{
  unsigned long *p, *q;
  int i;

  q = p = malloc (n * sizeof (unsigned long));
  if (p == NULL)
return 2;
  for (i = 0; i  n - 1; i++)
p[i] = 0;
  p[n - 1] = 1;
  while ((*(q++))-- == 0) ;
  return p[n - 1] == 1;
}

int main (void)
{
  int r;

  r = test (17);
  printf (%d\n, r);
  return r;
}

-- 
Vincent Lefèvre vinc...@vinc17.org - Web: http://www.vinc17.org/
100% accessible validated (X)HTML - Blog: http://www.vinc17.org/blog/
Work: CR INRIA - computer arithmetic / Arenaire project (LIP, ENS-Lyon)



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