Bug 88095 - RFE: initialize 'dummy' locals to be valgrind-friendly
RFE: initialize 'dummy' locals to be valgrind-friendly
Product: Red Hat Linux
Classification: Retired
Component: glibc (Show other bugs)
i386 Linux
medium Severity medium
: ---
: ---
Assigned To: Jakub Jelinek
Brian Brock
: FutureFeature
Depends On:
  Show dependency treegraph
Reported: 2003-04-05 11:00 EST by John Reiser
Modified: 2016-11-24 09:53 EST (History)
1 user (show)

See Also:
Fixed In Version:
Doc Type: Enhancement
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2003-04-17 00:05:48 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)
proposed patch for glibc-2.3.2-27.9 (12.99 KB, patch)
2003-04-16 17:34 EDT, John Reiser
no flags Details | Diff

  None (edit)
Description John Reiser 2003-04-05 11:00:39 EST
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 17:17:24 EST
Two more cases are:

      size_t non_reversible;
wcsmbs/mbsrtowcs.c:60:  size_t non_reversible;
Comment 2 John Reiser 2003-04-16 17:34:02 EDT
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 00:05:48 EDT
glibc is a runtime library.  No work which isn't necessary is done.

Note You need to log in before you can comment on or make changes to this bug.