Bug 502324

Summary: s390x: Memcheck false positives with TMxx and TM/TMY
Product: [Developer tools] valgrind Reporter: Andreas Arnez <arnez>
Component: vexAssignee: Andreas Arnez <arnez>
Status: RESOLVED FIXED    
Severity: normal    
Priority: NOR    
Version First Reported In: unspecified   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description Andreas Arnez 2025-04-02 15:41:18 UTC
It has been observed that memcheck reports false positives on s390x when a partially undefined value is tested with one of the TMLL, TMLH, TMHL, or TMHH instructions. These instructions test an operand against a given mask. Zero mask bits indicate that the corresponding bits in the operand shall be "don't care". But memcheck complains anyway if one of these bits is undefined and the resulting condition code is used outside the current block.

One example how this may happen is like this:

  tmll %r5,0x0080   # condition code is generated
  mvc ...           # new block, since mvc results in a loop
  jne  1f           # condition code is used

Let's assume that only the lowest byte of %r5 was initialized. This would be perfectly fine for the result of tmll, but memcheck would still complain.

Essentially the same issue exists with TM and TMY.
Comment 1 Andreas Arnez 2025-04-02 17:59:50 UTC
These commits should fix the issue:
a95ba0d6e549764d5a68536efc6eb1545b537c09 - Fixes TMxx
29f8a0ad4ed17d9cdf4a5d6661a51d25db6fc472 - Fixes TM/TMY
8d5cd244c7a81931ee17c3a7d46691774847222b - Adds a test case