Valgrind reports "Conditional jump or move depends on uninitialised value(s)" on every program

StackOverflow https://stackoverflow.com/questions/23663008

  •  22-07-2023
  •  | 
  •  

Question

I'm working through "Learn C the Hardway" and using valgrind to debug my programs, but it keeps giving me the same error, even on programs I know for a fact are correct. I'm running ubuntu on a VMware virtual machine which I thought might be the problem but it works fine on another Windows computer using the same setup. I originally built valgrind from sratch per the book but removed it and used sudo-apt get install to see if it made a difference but still same error.

Here's the error on a simple hello world program and I get the exact same results on every C program I run.

bizarro@ubuntu:~/Dropbox/Programming/C/TheHardWay/Exercises$ valgrind ./ex1
==8625== Memcheck, a memory error detector
==8625== Copyright (C) 2002-2013, and GNU GPL'd, by Julian Seward et al.
==8625== Using Valgrind-3.9.0 and LibVEX; rerun with -h for copyright info
==8625== Command: ./ex1
==8625== 
==8625== Conditional jump or move depends on uninitialised value(s)
==8625==    at 0x4019B04: index (strchr.S:77)
==8625==    by 0x4007DED: expand_dynamic_string_token (dl-load.c:425)
==8625==    by 0x4008D71: _dl_map_object (dl-load.c:2538)
==8625==    by 0x40014BD: map_doit (rtld.c:627)
==8625==    by 0x400FFF3: _dl_catch_error (dl-error.c:187)
==8625==    by 0x4000B2E: do_preload (rtld.c:816)
==8625==    by 0x400446C: dl_main (rtld.c:1633)
==8625==    by 0x4017564: _dl_sysdep_start (dl-sysdep.c:249)
==8625==    by 0x4004CF7: _dl_start (rtld.c:332)
==8625==    by 0x40012D7: ??? (in /lib/x86_64-linux-gnu/ld-2.19.so)
==8625== 
Hello world.
This is a the print function
It prints things and needs a semi colon at the end
Which im not used to. Python has made me sloppy  
I miss Python already
==8625== 
==8625== HEAP SUMMARY:
==8625==     in use at exit: 0 bytes in 0 blocks
==8625==   total heap usage: 0 allocs, 0 frees, 0 bytes allocated
==8625== 
==8625== All heap blocks were freed -- no leaks are possible
==8625== 
==8625== For counts of detected and suppressed errors, rerun with: -v
==8625== Use --track-origins=yes to see where uninitialised values come from
==8625== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 0 from 0)

edit*

Here is the code but like I said it gives this message independent of code.

#include <stdio.h>

int main(int argc, char *argv[])
{
    puts("Hello world.");
    puts("This is a the print function");
    puts("It prints things and needs a semi colon at the end");
    puts("Which im not used to. Python has made me sloppy");
    puts("I miss Python already");

    return 0;
}
Était-ce utile?

La solution

It looks as though Valgrind is identifying a potential issue within the C runtime. This isn't something you need to worry about, so I'd recommend that you create a suppressions file to ignore this particular warning.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top