ramosian-glider / memory-sanitizer

Automatically exported from code.google.com/p/memory-sanitizer
0 stars 0 forks source link

False positives in SSE intrinsics #48

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Repro:

$ cat sse.cc 
#include <emmintrin.h>

int main() {
  __m128i d;
  __m128i dst_pixel = _mm_load_si128(&d);
  _mm_srli_epi16(dst_pixel, 8);
  return 0;
}
$ clang++ sse.cc -fsanitize=memory
$ ./a.out 
==10545== WARNING: MemorySanitizer: use-of-uninitialized-value
...

Original issue reported on code.google.com by earth...@google.com on 19 Feb 2014 at 4:12

GoogleCodeExporter commented 9 years ago
Better reproducer that survives -O3:

#include <emmintrin.h>

int main() {
  __m128i d;
  __m128i * volatile p = &d;
  __m128i dst_pixel = _mm_load_si128(p);
  __m128i z =_mm_srli_epi16(dst_pixel, 8);
  return z[0];
}

Original comment by euge...@google.com on 20 Feb 2014 at 9:12

GoogleCodeExporter commented 9 years ago
MemorySanitizer instrumentation pass has this magical function 
maybeHandleSimpleNomemIntrinsic that takes care of all the vector arithmetic 
(in a very approximate but safe way), but does not handle certain shifts 
(namely, vector-by-scalar).

Original comment by euge...@google.com on 20 Feb 2014 at 9:18

GoogleCodeExporter commented 9 years ago
r202712, r202713 add support for all bitshift X86 intrinsics.

Original comment by euge...@google.com on 3 Mar 2014 at 2:45

GoogleCodeExporter commented 9 years ago
Adding Project:MemorySanitizer as part of GitHub migration.

Original comment by gli...@google.com on 30 Jul 2015 at 9:22