]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
s390x regtest: Add missing register clobber in misc3.c
authorAndreas Arnez <arnez@linux.ibm.com>
Fri, 8 Nov 2024 13:52:11 +0000 (14:52 +0100)
committerAndreas Arnez <arnez@linux.ibm.com>
Fri, 8 Nov 2024 13:52:11 +0000 (14:52 +0100)
Depending on compiler options, the translation of test_mvcrl() in
`misc3.c' can misbehave because the inline assembly writes to r0 and
doesn't declare that.

Add a register clobber to fix this.  Also, tell the compiler the actual
length of `from' and `to' instead of the decremented value.

none/tests/s390x/misc3.c

index eeeea1163c293ec5b59d95f201b1137fa1d4903d..c5df05ea5007b36d3f589f75c818e352a1bb07e0 100644 (file)
@@ -144,13 +144,12 @@ static void test_all_select()
 
 static void test_mvcrl(char *to, char *from, size_t len)
 {
-   len -= 1;
    __asm__("lgr    0,%[len]\n\t"
            ".insn  sse,0xe50a00000000,%[to],%[from]\n\t"
            : [to] "+Q" (*(char (*)[len]) to)
            : [from] "Q" (*(char (*)[len]) from),
-             [len] "d" (len)
-           : );
+             [len] "d" (len - 1)
+           : "0");
 }
 
 static void test_all_mvcrl()