FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Debian > Debian GCC

 
 
LinkBack Thread Tools
 
Old 11-20-2007, 01:09 PM
Frans Pop
 
Default 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!
");
else
printf ("nothing special here
") ;

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



--
To UNSUBSCRIBE, email to debian-gcc-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
 
Old 11-20-2007, 01:52 PM
Frans Pop
 
Default Bug#452108: gcc-4.2: Incorrect results with abs()

tags 452108 + patch
clone 452108 -1 -2 -3
reassign -1 gcc-4.1 4.1.2-17
reassign -2 gcc-3.3 1:3.3.6-15
reassign -3 gcc-3.4 3.4.6-6
thanks

On Tuesday 20 November 2007, Frans Pop wrote:
> The following test program will result in "OMG,-10==10 in linux!" when
> compiled with both gcc-4.1 and gcc-4.2.

Just tested that gcc-3.3 and gcc-3.4 are also affected.

Note that this issue is in theory pretty serious as in principle _any_
binary package in the archive could be affected.

A patch is available at:
http://www.nabble.com/-PATCH--Fix-PR34130,-extract_muldiv-broken-t4826688.html



--
To UNSUBSCRIBE, email to debian-gcc-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
 
Old 11-20-2007, 01:53 PM
Bastian Blank
 
Default Bug#452108: gcc-4.2: Incorrect results with abs()

On Tue, Nov 20, 2007 at 03:09:17PM +0100, Frans Pop wrote:
> The following test program will result in "OMG,-10==10 in linux!" when
> compiled with both gcc-4.1 and gcc-4.2.

Further information:

| int i = 2;
| int a = -10 * abs (i - 1);
| int b = 10 * abs (i - 1);
compiles to (original tree)
| int i = 2;
| int a = ABS_EXPR <i * -10 + 10>;
| int b = ABS_EXPR <i * 10 + -10>;

| int i = 2;
| int a = -10 * abs (i);
| int b = 10 * abs (i);
compiles to
| int i = 2;
| int a = ABS_EXPR <i> * -10;
| int b = ABS_EXPR <i> * 10;

Bastian

--
There is a multi-legged creature crawling on your shoulder.
-- Spock, "A Taste of Armageddon", stardate 3193.9
 
Old 11-20-2007, 02:42 PM
Frans Pop
 
Default Bug#452108: gcc-4.2: Incorrect results with abs()

found 452113 4.1.1-21
found 452114 3.3.5-13
found 452114 3.3.6-15
found 452115 3.4.3-13sarge1
found 452115 3.4.6-5
thanks

On Tuesday 20 November 2007, Frans Pop wrote:
> Just tested that gcc-3.3 and gcc-3.4 are also affected.

Sarge and Etch versions of 3.3, 3.4 and 4.1 are affected as well.
gcc-2.95 (2.95.4-{22,27}) is _not_ affected.



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

Thread Tools




All times are GMT. The time now is 10:55 AM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org