All, I have an issue with valgrind-3.8.1 (openSuSE 13.1 x86_64) reporting the error:
Conditional jump or move depends on uninitialised value(s) The error stems from reallocation of a new block of memory. The error is triggered when iterating over the reallocated pointer array into the reallocated block, despite explicitly setting/initializing values of the new pointers to 0 with memset (equivalent to the original allocation with calloc). A quick example program illustrating the issue is here: [2.9k] http://www.3111skyline.com/dl/dev/lists/vg_ui_values.c.txt .txt added for online readability. For direct d/l use: http://www.3111skyline.com/dl/dev/lists/vg_ui_values.c It simply reads any text file and reallocates pointers as needed after 4 lines are read. Compile with -DVGERR to reproduce the error. A default compile avoids the error by using a for loop to avoid touching what valgrind considers uninitialized. So in summary, compile as follow to test with/without the error: With Error: gcc -Wall -Wextra -DVGERR -o vg_ui_error vg_ui_values.c Without: gcc -Wall -Wextra -o vg_ui_clean vg_ui_values.c Then simply run: valgrind ./vg_ui_error some_text_file (where the text file has more than 4 lines of text) Since the values for the new block contents is set with memset, why does valgrind complain that the memory is uninitialized? Is this correct behavior for valgrind, or is valgrind for some reason not tracking the values set by memset as initialized? I've looked at http://valgrind.org/docs/manual/mc-manual.html#mc-manual.uninitvals, etc.. and I am unclear whether valgrind should throw this error? ...or... whether valgrind should correctly track the memset pointers as initialized? What say the experts? -- David C. Rankin, J.D.,P.E. ------------------------------------------------------------------------------ Dive into the World of Parallel Programming The Go Parallel Website, sponsored by Intel and developed in partnership with Slashdot Media, is your hub for all things parallel software development, from weekly thought leadership blogs to news, videos, case studies, tutorials and more. Take a look and join the conversation now. http://goparallel.sourceforge.net/ _______________________________________________ Valgrind-users mailing list Valgrind-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/valgrind-users