]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
s390x: Add missing early-clobber to GET_STARTREGS
authorAndreas Arnez <arnez@linux.ibm.com>
Wed, 9 Oct 2024 15:10:08 +0000 (17:10 +0200)
committerAndreas Arnez <arnez@linux.ibm.com>
Wed, 9 Oct 2024 15:10:08 +0000 (17:10 +0200)
The inline assembly for GET_STARTREGS in m_libcassert.c writes to its
output before using the input argument.  But since the compiler doesn't
know this, it is allowed to allocate the same register for both, causing
problems.  This has been seen when compiling Valgrind with -O0, after
which memcheck/tests/leak-autofreepool-5 fails due to SIGSEGV.

Fix this by declaring the output as early-clobber, so the compiler knows
about the restriction.

coregrind/m_libcassert.c

index db9d43d8741df066afe6451adafb0266e043a41a..257c26bc631342d295efba2180a4819ed9b2498c 100644 (file)
            "std %%f5, 64(%1);"                            \
            "std %%f6, 72(%1);"                            \
            "std %%f7, 80(%1);"                            \
-           : /* out */   "=r" (ia)                        \
+           : /* out */   "=&r" (ia)                       \
            : /* in */    "a" (&block[0])                  \
            : /* trash */ "memory"                         \
         );                                                \