Valgrind buildbot failures

Tilmann Scheller t.scheller at samsung.com
Fri Jul 25 08:07:25 PDT 2014


Hi,

the Valgrind builbot (http://lab.llvm.org:8011/builders/clang-x86_64-linux-vg) has been red for quite some time, I found some time today to start looking into the failures.

The majority of the failures seems to be an instance of this reduced test case:

#include <cstdio>
#include <llvm/Support/Path.h>
#include <llvm/ADT/StringRef.h>

using namespace llvm;

int main(int argc, char** argv) {
  StringRef str("/");

  for (sys::path::reverse_iterator I = sys::path::rbegin(str),
                                   E = sys::path::rend(str);
       I != E; ++I) {
    StringRef tmp = *I;
    printf("str: %p %s %lu\n",  &tmp, tmp.data(), tmp.size());
  }

  return 0;
}

Compiling this with clang at -O1 results in the following errors reported by Valgrind:

==2649== Conditional jump or move depends on uninitialised value(s)
==2649==    at 0x32AE448EE4: vfprintf (in /usr/lib64/libc-2.18.so)
==2649==    by 0x32AE451F28: printf (in /usr/lib64/libc-2.18.so)
==2649==    by 0x403BD4: main (in /home/t/work/arm/llvm/a.out)
==2649==
==2649== Use of uninitialised value of size 8
==2649==    at 0x32AE4490CF: vfprintf (in /usr/lib64/libc-2.18.so)
==2649==    by 0x32AE451F28: printf (in /usr/lib64/libc-2.18.so)
==2649==    by 0x403BD4: main (in /home/t/work/arm/llvm/a.out)
==2649==
....

I suspect that somewhere in the iterator we have some off by one bug. Changing the iterator to a forward iterator doesn't trigger the bug.

I'll probably look deeper into this next week, just sharing my initial results here hoping that someone more familiar with the sys::path iterator code can spot the bug before I do.

Regards,

Tilmann





More information about the llvm-commits mailing list