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:
Two more cases are: intl/dcigettext.c:851: size_t non_reversible; wcsmbs/mbsrtowcs.c:60: size_t non_reversible;
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.
glibc is a runtime library. No work which isn't necessary is done.