A conditional jump or jump depends on an uninitialized value (s) in a simple C program

I am new to C and am learning valgrind.

Below is my program. It compiles fine, but when I run valgrind, I see a stack trace "Conditional jump or move depends on uninitialised value(s)".

I am trying to find where the uninitialized value is in the program. I also get a similar result when I use "--track-origins=yes".

I tried to consider other questions about the stack overflow, but could not find a definitive answer to this question.

Where is the uninitialized value?

The code:

  1 #include <stdio.h>
  2 
  3 int main()
  4 {
  5    int x = 5;
  6    x = 6;
  7    printf ("Hello World %d\n", x);
  8 
  9    return 0;
 10 }

Valgrind output below.

==10154== Conditional jump or move depends on uninitialised value(s)
==10154==    at 0x1003FAC3F: _platform_memchr$VARIANT$Haswell (in /usr/lib/system/libsystem_platform.dylib)
==10154==    by 0x1001EEB96: __sfvwrite (in /usr/lib/system/libsystem_c.dylib)
==10154==    by 0x1001F8FE5: __vfprintf (in /usr/lib/system/libsystem_c.dylib)
==10154==    by 0x10021E9AE: __v2printf (in /usr/lib/system/libsystem_c.dylib)
==10154==    by 0x10021EC80: __xvprintf (in /usr/lib/system/libsystem_c.dylib)
==10154==    by 0x1001F4B71: vfprintf_l (in /usr/lib/system/libsystem_c.dylib)
==10154==    by 0x1001F29D7: printf (in /usr/lib/system/libsystem_c.dylib)
==10154==    by 0x100000F5D: main (ex1.c:7)
==10154== 
Hello World 6
+4
source share
1 answer

Valgrind , , , "(/usr/lib/system/libsystem_c.dylib)",

Valgrind. Valgrind OS X. ! XCode Instruments, /usr/bin/leaks /usr/bin/malloc_history, ...

0

All Articles