From: Julian S. <js...@ac...> - 2012-02-18 22:52:40
|
> Background: I am using Valgrind on optimized SSE4.2 output from the > Intel C Compiler. I am seeing massive amounts of "Invalid read of > size 8" false positives. I believe these false positives would > disappear if "--partial-loads-ok=yes" worked as documented. The > problem is that it does not work for 16-byte SSE loads; Valgrind's > behavior appears to be to treat such loads as a pair of 8-byte loads. > > Note that GCC has started to emit similar code > (https://bugs.kde.org/show_bug.cgi?id=294285), and I suspect it will > only become more common as compilers get smarter. For whatever it's worth .. The documentation never claimed that Memcheck will work sanely for ultra optimised code. In fact it recommends restricting yourself to gcc -g -O1, which works fairly well in practice as a tradeoff between performance and debuggability. That said, I did do some work to make --partial-loads-ok=yes work correctly for 16 byte SSE loads. But it never got committed, and is still sitting in some tree around here somewhere. The main problem, as you surmise, is that such loads get treated as two 8 byte loads, and so there's no easy way for --partial-loads-ok=yes to do the right thing. I think the hack I did makes it possible for mc_main.c to know whether an 8 byte load is really "itself", or whether it's half of a 16 byte load (and in that case, which half). I don't really remember though. I'd have to look over the diff again. J |