From b8e517e9acfec7dd6ec3b9bd46ec2b2eaecd83cc Mon Sep 17 00:00:00 2001 From: Andreas Arnez Date: Fri, 8 Nov 2024 14:52:11 +0100 Subject: [PATCH] s390x regtest: Add missing memory clobbers in mvc.c The s390x test case `mvc' was seen to fail when using gcc -O3 with GCC 11.4.1 on Ubuntu: mvc: mvc.c:48: main: Assertion `full[i] == 'x'' failed. In this case the compiler optimized the assertion check away, because it doesn't consider `full' to be affected by the inline assembly. Add memory clobbers to fix this. --- none/tests/s390x/mvc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/none/tests/s390x/mvc.c b/none/tests/s390x/mvc.c index 636234b579..2da8758fc3 100644 --- a/none/tests/s390x/mvc.c +++ b/none/tests/s390x/mvc.c @@ -34,7 +34,7 @@ int main(void) printf("before: target = |%s|\n", target); asm volatile( "mvi 0(%0),'x'\n\t" // target[1] = 'x' "mvc 1(2,%0),0(%0)\n\t" // target[2:3] = target[1] - :: "a" (target+1)); + :: "a" (target+1) : "memory"); printf("after: target = |%s|\n", target); /* Destructive overlap #3 */ @@ -42,7 +42,7 @@ int main(void) memset(full, '-', sizeof full); full[0] = 'x'; asm volatile( "mvc 1(256,%0),0(%0)\n\t" // full[1:256] = full[0] - :: "a" (full)); + :: "a" (full) : "memory"); /* Verify: the first 256+1 characters should be 'x' followed by '-' */ for (i = 0; i <= 256; ++i) assert(full[i] == 'x'); -- 2.39.5