From 943669f4ea16381154ec0cb26237e901d34e6d83 Mon Sep 17 00:00:00 2001 From: Andreas Arnez Date: Wed, 9 Oct 2024 17:10:08 +0200 Subject: [PATCH] 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. --- 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 db9d43d87..257c26bc6 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" \ ); \ -- 2.47.2