[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#452108: gcc-4.2: Incorrect results with abs()



Package: gcc-4.2
Version: 4.2.2-3
Severity: important

At least gcc-4.2 and gcc-4.1 but probably also earlier versions are affected
by a bug discussed on the linux-kernel list [1].

The following test program will result in "OMG,-10==10 in linux!" when
compiled with both gcc-4.1 and gcc-4.2.

int main( void )
{
  int i=2;
  if( -10*abs (i-1) == 10*abs(i-1) )
    printf ("OMG,-10==10 in linux!\n");
  else
    printf ("nothing special here\n") ;

  return 0 ;
}

[1] http://lkml.org/lkml/2007/11/19/493

-- System Information:
Debian Release: lenny/sid
  APT prefers unstable
  APT policy: (500, 'unstable')
Architecture: amd64 (x86_64)

Kernel: Linux 2.6.24-rc3 (SMP w/4 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash

Versions of packages gcc-4.2 depends on:
ii  binutils            2.18.1~cvs20071027-1 The GNU assembler, linker and bina
ii  cpp-4.2             4.2.2-3              The GNU C preprocessor
ii  gcc-4.2-base        4.2.2-3              The GNU Compiler Collection (base 
ii  libc6               2.6.1-6              GNU C Library: Shared libraries
ii  libgcc1             1:4.2.2-3            GCC support library
ii  libgomp1            4.2.2-3              GCC OpenMP (GOMP) support library

Versions of packages gcc-4.2 recommends:
ii  libc6-dev                     2.6.1-6    GNU C Library: Development Librari

-- no debconf information




Reply to: