bugGNU Scientific Library - Bugs: bug #21834, integer overflow with gcc 4.3 on...

 
 

You are not allowed to post comments on this tracker with your current authentication level.

bug #21834: integer overflow with gcc 4.3 on solaris

Submitted by:  -Deleted Account- <bjg>
Submitted on:  Tue 18 Dec 2007 06:46:53 PM UTC  
 
Category: BuildSeverity: 3 - Normal
Operating System: Status: Fixed
Assigned to: NoneOpen/Closed: Closed
Release: 1.10

Tue 18 Dec 2007 06:46:53 PM UTC, original submission:

From: Richard Guenther <rguenther@suse.de>
To: -unavailable-
Cc: -unavailable-
Subject: Re: Bug-gsl GSL on Solaris problems
Date: Tue, 30 Oct 2007 14:02:14 +0100 (CET)

This also occurs on linux with GCC 4.3 and the problem is likely that
the overflow check in

void
FUNCTION (my, initialize) (TYPE (gsl_vector) * v)
{
size_t i;
ATOMIC k = 0, kk;

/* Must be sorted initially */

for (i = 0; i < v->size; i++)
{
kk = k;
k++;
if (k < kk) /* prevent overflow */
k = kk;
FUNCTION (gsl_vector, set) (v, i, k);
}
}

is broken for signed integral values. As the ISO C standard defines
signed integer overflow as invoking undefined behavior, the post-the-fact
check is optimized away by compilers. That this triggers only the signed
char case is probably due to the sizes not causing overflow on other
singed integral tests.

Unfortunately due to the type generic way you cannot do tricks like using
unsigned arithmetic here, but making k volatile should prevent the
optimization from happening.

Richard.

--
Richard Guenther <rguenther@suse.de>
Novell / SUSE Labs
SUSE LINUX Products GmbH - Nuernberg - AG Nuernberg - HRB 16746 - GF: Markus Rex

-Deleted Account- <bjg>

 

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

CC list is empty

 

Please enter the title of George Orwell's famous dystopian book (it's a date):

 

 

Follow 2 latest changes.

Date Changed By Updated Field Previous Value => Replaced By
Sat 09 Feb 2008 07:51:50 PM UTCbjgStatusNone=>Fixed
  Open/ClosedOpen=>Closed

Back to the top


Powered by Savane 3.1-cleanup1