]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Bug 502324 - Add test case for TMx memcheck false positives
authorAndreas Arnez <arnez@linux.ibm.com>
Wed, 2 Apr 2025 17:52:26 +0000 (19:52 +0200)
committerAndreas Arnez <arnez@linux.ibm.com>
Wed, 2 Apr 2025 17:52:26 +0000 (19:52 +0200)
Add a regression test for Bug 502324.  Before the bug was fixed, this test
failed with various "conditional jump or move depends on uninitialised
value(s)" messages.

.gitignore
NEWS
memcheck/tests/s390x/Makefile.am
memcheck/tests/s390x/tmxx.c [new file with mode: 0644]
memcheck/tests/s390x/tmxx.stderr.exp [new file with mode: 0644]
memcheck/tests/s390x/tmxx.stdout.exp [new file with mode: 0644]
memcheck/tests/s390x/tmxx.vgtest [new file with mode: 0644]

index f9e50b135758c5e95a7cff52762d8f232c02d8f5..f58e91dd839237f7c15f18fed5961e9d91701ab5 100644 (file)
 /memcheck/tests/s390x/cu21
 /memcheck/tests/s390x/cu42
 /memcheck/tests/s390x/ltgjhe
+/memcheck/tests/s390x/tmxx
 /memcheck/tests/s390x/vstrc
 /memcheck/tests/s390x/vfae
 /memcheck/tests/s390x/vistr
diff --git a/NEWS b/NEWS
index 7f1d4246c38edaee11be14a288124d1db7d89483..ee501aef698785ad547bd8b0d6b5f6aac4958f9c 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -73,6 +73,7 @@ are not entered into bugzilla tend to get forgotten about or ignored.
 501893  Missing suppression for __wcscat_avx2 (strcat-strlen-avx2.h.S:68)?
 502126  glibc 2.41 extra syscall_cancel frames
 502288  s390x: Memcheck false positives with NNPA last tensor dimension
+502324  s390x: Memcheck false positives with TMxx and TM/TMY
 
 To see details of a given bug, visit
   https://bugs.kde.org/show_bug.cgi?id=XXXXXX
index 095c07c7f35c6204d818f61d601d85907f4bdac7..32a898ca5fc4fce1658df5ce2997e3757c2b441d 100644 (file)
@@ -2,7 +2,7 @@ include $(top_srcdir)/Makefile.tool-tests.am
 
 dist_noinst_SCRIPTS = filter_stderr
 
-INSN_TESTS = cdsg cli cu21 cu42 ltgjhe vstrc vfae vistr vstrs
+INSN_TESTS = cdsg cli cu21 cu42 ltgjhe tmxx vstrc vfae vistr vstrs
 
 check_PROGRAMS = $(INSN_TESTS) 
 
diff --git a/memcheck/tests/s390x/tmxx.c b/memcheck/tests/s390x/tmxx.c
new file mode 100644 (file)
index 0000000..ed4447f
--- /dev/null
@@ -0,0 +1,50 @@
+#include <stdio.h>
+
+union foo {
+   char a;
+   unsigned long val;
+};
+
+static int do_tmhh(unsigned long val, int eq, int neq)
+{
+   int ret = eq;
+   int alt = neq;
+   __asm__("tmhh    %[val],0xf000\n\t"
+           "jo      1f\n\t"
+           "nopr    0\n"
+           "1:\t"
+           "locgrne %[ret],%[alt]"
+           : [ret] "+d"(ret)
+           : [val] "d"(val), [alt] "d"(alt)
+           : "cc");
+   return ret;
+}
+
+static int do_tm(unsigned char val, int eq, int neq)
+{
+   int ret = eq;
+   int alt = neq;
+   __asm__("tm      %[val],0xf0\n\t"
+           "jo      1f\n\t"
+           "nopr    0\n"
+           "1:\t"
+           "locgrne %[ret],%[alt]"
+           : [ret] "+d"(ret)
+           : [val] "Q"(val), [alt] "d"(alt)
+           : "cc");
+   return ret;
+}
+
+int main(void)
+{
+   volatile union foo a;
+   a.a = 0x40;
+   printf("%c\n", do_tmhh(a.val, 'A', 'B'));
+   a.val = a.val << 1;
+   printf("%c\n", do_tmhh(a.val, 'C', 'D'));
+   printf("%c\n", do_tm(a.a, 'E', 'F'));
+   a.val = a.val << 1;
+   printf("%c\n", do_tmhh(a.val, 'G', 'H'));
+   printf("%c\n", do_tm(a.a, 'I', 'J'));
+   return 0;
+}
diff --git a/memcheck/tests/s390x/tmxx.stderr.exp b/memcheck/tests/s390x/tmxx.stderr.exp
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/memcheck/tests/s390x/tmxx.stdout.exp b/memcheck/tests/s390x/tmxx.stdout.exp
new file mode 100644 (file)
index 0000000..af2c2d5
--- /dev/null
@@ -0,0 +1,5 @@
+B
+D
+F
+G
+I
diff --git a/memcheck/tests/s390x/tmxx.vgtest b/memcheck/tests/s390x/tmxx.vgtest
new file mode 100644 (file)
index 0000000..650afd4
--- /dev/null
@@ -0,0 +1,2 @@
+prog: tmxx
+vgopts: -q