title: Valgrind errors on simple C string functions
body: <p>Let's consider this simple test program:</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  #include &lt;string.h&gt;
  
  int main(int argc, char *argv[])
  {
          char buf[256];
          int i;
  
          strcpy(buf,"Hello world!");
          i = strlen(buf);
          printf("Length of string is %d.\n",i);
          return 0;
  }
  </code></pre>
  
  <p>When compiling it with the Intel c++ compiler and optimizations turned on (O3), I get the following errors from valgrind:</p>
  
  <pre><code>==8727== Conditional jump or move depends on uninitialised value(s)
  ==8727==    at 0x4009EF: main (strtest.cpp:11)
  ==8727== Use of uninitialised value of size 8
  ==8727==    at 0x4FC61ED: _itoa_word (in /lib64/libc-2.4.so)
  ==8727==    by 0x4FC9317: vfprintf (in /lib64/libc-2.4.so)
  ==8727==    by 0x4FD02A9: printf (in /lib64/libc-2.4.so)
  ==8727==    by 0x400A09: main (strtest.cpp:13)
  ==8727== Conditional jump or move depends on uninitialised value(s)
  ==8727==    at 0x4FC61F7: _itoa_word (in /lib64/libc-2.4.so)
  ==8727==    by 0x4FC9317: vfprintf (in /lib64/libc-2.4.so)
  ==8727==    by 0x4FD02A9: printf (in /lib64/libc-2.4.so)
  ==8727==    by 0x400A09: main (strtest.cpp:13)
  ==8727== Conditional jump or move depends on uninitialised value(s)
  ==8727==    at 0x4FC9386: vfprintf (in /lib64/libc-2.4.so)
  ==8727==    by 0x4FD02A9: printf (in /lib64/libc-2.4.so)
  ==8727==    by 0x400A09: main (strtest.cpp:13)
  ==8727== Conditional jump or move depends on uninitialised value(s)
  ==8727==    at 0x4FC990F: vfprintf (in /lib64/libc-2.4.so)
  ==8727==    by 0x4FD02A9: printf (in /lib64/libc-2.4.so)
  ==8727==    by 0x400A09: main (strtest.cpp:13)
  ==8727== Conditional jump or move depends on uninitialised value(s)
  ==8727==    at 0x4FC82F2: vfprintf (in /lib64/libc-2.4.so)
  ==8727==    by 0x4FD02A9: printf (in /lib64/libc-2.4.so)
  ==8727==    by 0x400A09: main (strtest.cpp:13)
  </code></pre>
  
  <p>I am using the most recent version of valgrind (3.6.1). This does not happen when turning optimizations off (-O0), and it does not happen with g++. However, it appears with all Intel compilers I have tried out so far (11.0, 11.1, 12).</p>
  
  <p>It seems that the errors are related to SIMD-acceleration of the string functions, like discussed in <a href="https://stackoverflow.com/questions/3246008/c-strings-strlen-and-valgrind">C strings, strlen and Valgrind</a>.</p>
  
  <p>There it was stated that this was a bug in valgrind and is fixed now. However, although using the newest valgrind version, I still have these errors. Does anybody know some help about this?</p>