Files
clang-p2996/compiler-rt/test/msan/Linux/strerror_r.cc
Vitaly Buka d9bc851fb3 [tsan]: Fix GNU version of strerror_r interceptor
GNU version of strerror_r returns a result pointer that doesn't match the input
buffer. The result pointer is in fact a pointer to some internal storage.
TSAN was recording a write to this location, which was incorrect.

Fixed https://github.com/google/sanitizers/issues/696

llvm-svn: 304858
2017-06-07 01:53:38 +00:00

19 lines
330 B
C++

// RUN: %clang_msan -O0 -g %s -o %t && %run %t
#include <assert.h>
#include <errno.h>
#include <string.h>
int main() {
char buf[1000];
char *res = strerror_r(EINVAL, buf, sizeof(buf));
assert(res);
volatile int z = strlen(res);
res = strerror_r(-1, buf, sizeof(buf));
assert(res);
z = strlen(res);
return 0;
}