From: Andreas A. <ar...@so...> - 2024-10-09 15:11:26
|
https://sourceware.org/git/gitweb.cgi?p=valgrind.git;h=943669f4ea16381154ec0cb26237e901d34e6d83 commit 943669f4ea16381154ec0cb26237e901d34e6d83 Author: Andreas Arnez <ar...@li...> Date: Wed Oct 9 17:10:08 2024 +0200 s390x: Add missing early-clobber to GET_STARTREGS 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. Diff: --- coregrind/m_libcassert.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/coregrind/m_libcassert.c b/coregrind/m_libcassert.c index db9d43d874..257c26bc63 100644 --- a/coregrind/m_libcassert.c +++ b/coregrind/m_libcassert.c @@ -177,7 +177,7 @@ "std %%f5, 64(%1);" \ "std %%f6, 72(%1);" \ "std %%f7, 80(%1);" \ - : /* out */ "=r" (ia) \ + : /* out */ "=&r" (ia) \ : /* in */ "a" (&block[0]) \ : /* trash */ "memory" \ ); \ |