Bug 394227

Summary: [x86] False negative "uninitialised value" report due to not recognizing simd registers clear by pcmp*
Product: [Developer tools] valgrind Reporter: myocytebd
Component: memcheckAssignee: Julian Seward <jseward>
Status: REPORTED ---    
Severity: normal CC: ace17, nh2, philippe.waroquiers
Priority: NOR    
Version First Reported In: 3.12.0   
Target Milestone: ---   
Platform: Other   
OS: All   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:

Description myocytebd 2018-05-14 04:03:28 UTC
It is common to generate constants in simd registers.
It typically begins by clearing the simd register to all-one, by pcmp* family.
For example:
pcmpeqw xmm0, xmm0

However, valgrind 3.12 (Ubuntu x64) fails to recognize this combination and populates uninitialized values around.
(Changing it to load or load+shuffle will suppress the warning)
Comment 1 Philippe Waroquiers 2018-05-14 20:53:43 UTC
The title of the bug report indicates x86, but below you indicate x64.
Is this a problem with 32 bits intel or 64 bits intel ?

Do you have a small compilable reproducer ?
I am sure that will help the knowledgeable people (i.e. not me :))
to analyse and maybe fix your problem.
Comment 2 ace17 2018-05-23 11:00:11 UTC
Might be related to: https://github.com/libjpeg-turbo/libjpeg-turbo/issues/238
Comment 3 Julian Seward 2018-09-03 06:36:36 UTC
This is probably easy to fix, but we need a test case that shows the
problem for all pcmpeq variants that you are interested in.  Can you
supply one?
Comment 4 nh2 2020-02-03 00:58:56 UTC
The specific case of `pcmpeqw xmm0, xmm0` is claimed to be fixed in issue https://bugs.kde.org/show_bug.cgi?id=290006.

Yet, there are still issues with valgrind on libjpeg-turbo (see https://github.com/libjpeg-turbo/libjpeg-turbo/issues/277#issuecomment-581198382), suggesting that either the fix is incomplete or that other instructions are involved.
Comment 5 nh2 2020-02-03 00:59:29 UTC
Also related: https://bugs.kde.org/show_bug.cgi?id=398153