title: Valgrind on OS X Yosemite, giving bogus errors?
body: <p>I'm following along in <a href="http://c.learncodethehardway.org/book/" rel="nofollow noreferrer">Learn C The Hard Way</a> and I'm on <a href="http://c.learncodethehardway.org/book/ex4.html" rel="nofollow noreferrer">Exercise 4: Introducing Valgrind</a>. I'm on Mac OS X Yosemite, and as of this writing, there's not a stable build of Valgrind for Yosemite. I found <a href="https://stackoverflow.com/questions/26564125/yosemite-and-valgrind">Yosemite and Valgrind</a> and used the directions from the top-voted answer to <code>brew install --HEAD valgrind</code>. This installed Valgrind and I was able to follow along with Zed's exercise. However, when I "fixed" the app, I was still getting errors. </p>
  
  <p>To double check, I went back to <a href="http://c.learncodethehardway.org/book/ex3.html" rel="nofollow noreferrer">Exercise 3</a>, which shouldn't have errors, but I still got errors in Valgrind. Here's the code and then the output:</p>
  
  <p>ex3.c</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  
  int main()
  {
      int age = 10;
      int height = 72;
  
      printf("I am %d years old.\n", age);
      printf("I am %d inches tall.\n", height);
  
      return 0;
  }
  </code></pre>
  
  <p>In iTerm:</p>
  
  <pre><code>ransom:learn-c-the-hard-way ben$ rm -f ex3
  ransom:learn-c-the-hard-way ben$ make ex3
  cc -Wall -g    ex3.c   -o ex3
  ransom:learn-c-the-hard-way ben$ valgrind ./ex3
  ==8795== Memcheck, a memory error detector
  ==8795== Copyright (C) 2002-2013, and GNU GPL'd, by Julian Seward et al.
  ==8795== Using Valgrind-3.11.0.SVN and LibVEX; rerun with -h for copyright info
  ==8795== Command: ./ex3
  ==8795==
  ==8795== Conditional jump or move depends on uninitialised value(s)
  ==8795==    at 0x1003FBC3F: _platform_memchr$VARIANT$Haswell (in /usr/lib/system/libsystem_platform.dylib)
  ==8795==    by 0x1001EFB96: __sfvwrite (in /usr/lib/system/libsystem_c.dylib)
  ==8795==    by 0x1001F9FE5: __vfprintf (in /usr/lib/system/libsystem_c.dylib)
  ==8795==    by 0x10021F9AE: __v2printf (in /usr/lib/system/libsystem_c.dylib)
  ==8795==    by 0x10021FC80: __xvprintf (in /usr/lib/system/libsystem_c.dylib)
  ==8795==    by 0x1001F5B71: vfprintf_l (in /usr/lib/system/libsystem_c.dylib)
  ==8795==    by 0x1001F39D7: printf (in /usr/lib/system/libsystem_c.dylib)
  ==8795==    by 0x100000F2D: main (ex3.c:8)
  ==8795==
  ==8795== Conditional jump or move depends on uninitialised value(s)
  ==8795==    at 0x1003FBC47: _platform_memchr$VARIANT$Haswell (in /usr/lib/system/libsystem_platform.dylib)
  ==8795==    by 0x1001EFB96: __sfvwrite (in /usr/lib/system/libsystem_c.dylib)
  ==8795==    by 0x1001F9FE5: __vfprintf (in /usr/lib/system/libsystem_c.dylib)
  ==8795==    by 0x10021F9AE: __v2printf (in /usr/lib/system/libsystem_c.dylib)
  ==8795==    by 0x10021FC80: __xvprintf (in /usr/lib/system/libsystem_c.dylib)
  ==8795==    by 0x1001F5B71: vfprintf_l (in /usr/lib/system/libsystem_c.dylib)
  ==8795==    by 0x1001F39D7: printf (in /usr/lib/system/libsystem_c.dylib)
  ==8795==    by 0x100000F2D: main (ex3.c:8)
  ==8795==
  I am 10 years old.
  I am 72 inches tall.
  ==8795==
  ==8795== HEAP SUMMARY:
  ==8795==     in use at exit: 38,888 bytes in 426 blocks
  ==8795==   total heap usage: 506 allocs, 80 frees, 45,016 bytes allocated
  ==8795==
  ==8795== LEAK SUMMARY:
  ==8795==    definitely lost: 0 bytes in 0 blocks
  ==8795==    indirectly lost: 0 bytes in 0 blocks
  ==8795==      possibly lost: 0 bytes in 0 blocks
  ==8795==    still reachable: 4,096 bytes in 1 blocks
  ==8795==         suppressed: 34,792 bytes in 425 blocks
  ==8795== Rerun with --leak-check=full to see details of leaked memory
  ==8795==
  ==8795== For counts of detected and suppressed errors, rerun with: -v
  ==8795== Use --track-origins=yes to see where uninitialised values come from
  ==8795== ERROR SUMMARY: 4 errors from 2 contexts (suppressed: 0 from 0)
  </code></pre>
  
  <p>It says I'm getting <code>Conditional jump or move depends on uninitialized value(s)</code> on <code>ex3.c:8</code>, but the <code>height</code> variable is initialized on line 6.</p>
  
  <p>My <em>guess</em> is that this is a problem with Valgrind on Yosemite and the error is bogus, but I'm very new to C and while I'm fairly certain the code is correct, I also don't know if there might be something I'm missing.</p>
  
  <p>Is it a problem with Valgrind or my code?</p>