Your message dated Tue, 10 May 2011 14:39:37 +0200
with message-id <[email protected]>
and subject line Re: Bug#292439: valgrind: unused value detection bug ?
has caused the Debian Bug report #292439,
regarding valgrind: unused value detection bug ?
to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact [email protected]
immediately.)


-- 
292439: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=292439
Debian Bug Tracking System
Contact [email protected] with problems
--- Begin Message ---
Package: valgrind
Version: 1:2.2.0-4
Severity: important


look at the following little code :


#define POLYNOMIAL 0x04c11db7L

static unsigned long Repo2_CRCTable[256];

static void Repo2_GenCRCTable( void ) {
    /* generate the table of CRC remainders for all possible bytes */
    register int i, j;  
    register unsigned long CRC;

    for( i = 0;  i < 256;  i++ ) {
      CRC = ( (unsigned long) i << 24 );
      for ( j = 0;  j < 8;  j++ ) { 
        if ( CRC & 0x80000000L ) {
          CRC = ( CRC << 1 ) ^ POLYNOMIAL;
        } else {
          CRC = ( CRC << 1 );
        }
      }
      Repo2_CRCTable[i] = CRC;
    }
    return;
}

static unsigned long Repo2_UpdateCRC(
            unsigned long CRC, char * Data, int Size ) {
    /* update the CRC on the data block one byte at a time */
    register unsigned long i, j;
    unsigned long x;

    for( i = 0;  i < 256;  i++ ) {
      x = Repo2_CRCTable[i];
    }

    for ( j = 0;  j < Size;  j++ ) {
      i = ( (int) ( CRC >> 24) ^ * Data++ ) & 0xff;
      x = i;
      x = Repo2_CRCTable[33];
      x = Repo2_CRCTable[i]; // here is this is the error !!!!!
      CRC = ( CRC << 8 ) ^ Repo2_CRCTable[i];
    }

    return CRC;
}

called like this 

Repo2_GenCRCTable();
NewHdl.Header->CRC = Repo2_UpdateCRC( 0, 
            0, 
            (char *)((long)NewHdl.Header+sizeof( Repo2Header_t)),
            MapSize - sizeof( Repo2Header_t ) 
          );

generates

==12512== Use of uninitialised value of size 4
==12512==    at 0x1B91E3DC: Repo2_UpdateCRC (main_repo_A.c:201)
==12512==    by 0x1B923B0A: Repo2_Save (main_repo_A.c:1732)
==12512==    by 0x1B924F10: Repo2Db_Dispose (main_repo_A.c:2158)
==12512==    by 0x804CFBE: main (main_A.c:1713)
==12512==
==12512== ---- Attach to debugger ? --- [Return/N/n/Y/y/C/c] ---- 

line 201 being the line marked in comment 

when running dbg the value of i shows 33, hence the
statement just before.

Could this be a bug ?

-- System Information:
Debian Release: 3.1
  APT prefers unstable
  APT policy: (500, 'unstable')
Architecture: i386 (i686)
Kernel: Linux 2.6.9-1-686
Locale: LANG=en_US, LC_CTYPE=en_US (charmap=ISO-8859-1)

Versions of packages valgrind depends on:
ii  libc6                       2.3.2.ds1-20 GNU C Library: Shared libraries an

-- no debconf information


--- End Message ---
--- Begin Message ---
Version: 3.6.0-1

On Thu, Jan 27, 2005 at 01:26:52AM +0100, wim delvaux wrote:
> ==12512== Use of uninitialised value of size 4
> ==12512==    at 0x1B91E3DC: Repo2_UpdateCRC (main_repo_A.c:201)
> ==12512==    by 0x1B923B0A: Repo2_Save (main_repo_A.c:1732)
> ==12512==    by 0x1B924F10: Repo2Db_Dispose (main_repo_A.c:2158)
> ==12512==    by 0x804CFBE: main (main_A.c:1713)
> ==12512==
> ==12512== ---- Attach to debugger ? --- [Return/N/n/Y/y/C/c] ---- 

I've not been able to reproduce this warning with the last gcc and
valgrind. I assume this is long gone, hence close the bug, please reopen
with a more detailed test case if it's still here.

-- 
·O·  Pierre Habouzit
··O                                                [email protected]
OOO                                                http://www.madism.org


--- End Message ---

Reply via email to