3
votes

When I link my project with the static version of the library VALGRIND starts to report a bug number of "Conditional jump or move depends on uninitialised value" errors. The problem that the project itself does not contain anything except the empty main function so definitely the problem is in the library.

The shared and static binaries of the library are compiled separately and VALGRIND does not report anything when the library is linked as shared.

==4691== Conditional jump or move depends on uninitialised value(s)
==4691==    at 0x8108A88: __linkin_atfork (in /...)
==4691==    by 0x80F60CC: ptmalloc_init (in /...)
==4691==    by 0x80FA075: malloc_hook_ini (in /...)
==4691==    by 0x80F9FB8: malloc (in /...)
==4691==    by 0x812C9EB: _dl_init_paths (in /...)
==4691==    by 0x81093AF: _dl_non_dynamic_init (in /...)
==4691==    by 0x8109E5E: __libc_init_first (in /...)
==4691==    by 0x80DC90D: (below main) (in /...)
==4691==  Uninitialised value was created
==4691==    at 0x812A68E: brk (in /...)
==4691==    by 0x81065AC: sbrk (in /...)
==4691==    by 0x80DCC88: __libc_setup_tls (in /...)
==4691==    by 0x80DCE39: __pthread_initialize_minimal (in /...)
==4691==    by 0x80DC8AA: (below main) (in /...)

Is this errors should be ignored or they can be solved somehow?

2

2 Answers

0
votes

what if you call calloc instead calling malloc?

you may be accessing the data pointed to it after it has been malloc'ed but before the data is being assigned to it.

Calling calloc instead of malloc will hide the problem, but it wont solve the problem you have. make sure assign the data before referencing the data.

0
votes

It looks to me like errors that you should ignore (unless you are attaching weird libraries to your empty program). You can suppress them if you run Valgrind as follows:

    valgrind --gen-suppressions=yes ./program

Then, cut and paste it into a suppression file.

Read more here: http://valgrind.org/docs/manual/manual-core.html#manual-core.suppress