Note: This is a beta release of Red Hat Bugzilla 5.0. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Also email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback here.

Bug 88095

Summary: RFE: initialize 'dummy' locals to be valgrind-friendly
Product: [Retired] Red Hat Linux Reporter: John Reiser <jreiser>
Component: glibcAssignee: Jakub Jelinek <jakub>
Status: CLOSED WONTFIX QA Contact: Brian Brock <bbrock>
Severity: medium Docs Contact:
Priority: medium    
Version: 9CC: fweimer
Target Milestone: ---Keywords: FutureFeature
Target Release: ---   
Hardware: i386   
OS: Linux   
Fixed In Version: Doc Type: Enhancement
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2003-04-17 04:05:48 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Description Flags
proposed patch for glibc-2.3.2-27.9 none

Description John Reiser 2003-04-05 16:00:39 UTC
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.0.0) Gecko/20020529

Description of problem:
Please initialize don't-care local variables [typically named 'dummy'] that are
passed by reference to wide-string (multi-byte character) routines which use
their storage as counters.  Leaving them uninitialized causes valgrind to report
bad usage, which must be investigated and ignored.  The runtime cost is 7 bytes
of .text, and at most 1.5 CPU cycles, per variable.

Here are 13 cases.  Just initialize to 0.
./libio/iofwide.c:230:  size_t dummy;
./libio/iofwide.c:297:  size_t dummy;
./libio/iofwide.c:359:  size_t dummy;
./libio/iofwide.c:457:  size_t dummy;
./wcsmbs/btowc.c:57:      size_t dummy;
./wcsmbs/mbrtowc.c:42:  size_t dummy;
./wcsmbs/mbsnrtowcs.c:53:  size_t dummy;
./wcsmbs/wcrtomb.c:44:  size_t dummy;
./wcsmbs/wcsnrtombs.c:76:      size_t dummy;
./wcsmbs/wcsnrtombs.c:105:      size_t dummy;
./wcsmbs/wcsrtombs.c:70:      size_t dummy;
./wcsmbs/wcsrtombs.c:106:      size_t dummy;
./wcsmbs/wctob.c:36:  size_t dummy;

Version-Release number of selected component (if applicable):

How reproducible:

Steps to Reproduce:
1.Run any testcase which calls the indicated routines.

Actual Results:  valgrind complains of uninitialized memory.

Expected Results:  No complaints from valgrind.

Additional info:

Comment 1 John Reiser 2003-04-05 22:17:24 UTC
Two more cases are:

      size_t non_reversible;
wcsmbs/mbsrtowcs.c:60:  size_t non_reversible;

Comment 2 John Reiser 2003-04-16 21:34:02 UTC
Created attachment 91160 [details]
proposed patch for glibc-2.3.2-27.9

Here are the changes in patch format, including several other files with
'struct's with "don't care" pieces that a memory checker thinks will be read.

Comment 3 Ulrich Drepper 2003-04-17 04:05:48 UTC
glibc is a runtime library.  No work which isn't necessary is done.