Bug 88095 - RFE: initialize 'dummy' locals to be valgrind-friendly
Summary: RFE: initialize 'dummy' locals to be valgrind-friendly
Keywords:
Status: CLOSED WONTFIX
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: glibc
Version: 9
Hardware: i386
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Jakub Jelinek
QA Contact: Brian Brock
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2003-04-05 16:00 UTC by John Reiser
Modified: 2016-11-24 14:53 UTC (History)
1 user (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2003-04-17 04:05:48 UTC
Embargoed:


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

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):
glibc-2.3.2-11.9

How reproducible:
Always

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

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:

intl/dcigettext.c:851:
      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.


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