I am a C newbie and learning valgrind.
The following is my program. It compiles fine, but when I run valgrind, I see a "Conditional jump or move depends on uninitialised value(s)"
stack trace.
I am trying to find where is the uninitialised value in the program. I am seeing a similar output when I use "--track-origins=yes"
as well.
I tried looking at other questions on stack overflow, but could not find a definitive answer on this.
Where is uninitialised value?
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 is 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