From: Thomas Huth <thuth@redhat.com>
To: qemu-devel@nongnu.org, Peter Maydell <peter.maydell@linaro.org>
Cc: "Alex Bennée" <alex.bennee@linaro.org>
Subject: [PULL 5/6] target/riscv/vector_helper: Fix build on 32-bit big endian hosts
Date: Wed, 5 Aug 2020 11:57:54 +0200 [thread overview]
Message-ID: <20200805095755.16414-6-thuth@redhat.com> (raw)
In-Reply-To: <20200805095755.16414-1-thuth@redhat.com>
The code currently fails to compile on 32-bit big endian hosts:
target/riscv/vector_helper.c: In function 'vext_clear':
target/riscv/vector_helper.c:154:16: error: cast to pointer from integer
of different size [-Werror=int-to-pointer-cast]
memset((void *)((uintptr_t)tail & ~(7ULL)), 0, part1);
^
target/riscv/vector_helper.c:155:16: error: cast to pointer from integer
of different size [-Werror=int-to-pointer-cast]
memset((void *)(((uintptr_t)tail + 8) & ~(7ULL)), 0, part2);
^
cc1: all warnings being treated as errors
We should not use "long long" (i.e. 64-bit) values here to avoid the
problem. Switch to our QEMU_ALIGN_PTR_DOWN/UP macros instead.
Fixes: 751538d5da ("add vector stride load and store instructions")
Suggested-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Message-Id: <20200804170055.2851-3-thuth@redhat.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Thomas Huth <thuth@redhat.com>
---
target/riscv/vector_helper.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/target/riscv/vector_helper.c b/target/riscv/vector_helper.c
index 39f44d1029..793af99067 100644
--- a/target/riscv/vector_helper.c
+++ b/target/riscv/vector_helper.c
@@ -151,8 +151,8 @@ static void vext_clear(void *tail, uint32_t cnt, uint32_t tot)
if (cnt % 8) {
part1 = 8 - (cnt % 8);
part2 = tot - cnt - part1;
- memset((void *)((uintptr_t)tail & ~(7ULL)), 0, part1);
- memset((void *)(((uintptr_t)tail + 8) & ~(7ULL)), 0, part2);
+ memset(QEMU_ALIGN_PTR_DOWN(tail, 8), 0, part1);
+ memset(QEMU_ALIGN_PTR_UP(tail, 8), 0, part2);
} else {
memset(tail, 0, part2);
}
--
2.18.1
next prev parent reply other threads:[~2020-08-05 10:02 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-08-05 9:57 [PULL 0/6] Improve gitlab-CI and fix a compiler warning Thomas Huth
2020-08-05 9:57 ` [PULL 1/6] tests/docker: Add python3-venv and netcat to the debian-amd64 container Thomas Huth
2020-08-05 9:57 ` [PULL 2/6] tests/acceptance: Disable the rx sash and arm cubieboard replay test on Gitlab Thomas Huth
2020-08-05 9:57 ` [PULL 3/6] gitlab-ci.yml: Add build-system-debian and build-system-centos jobs Thomas Huth
2020-08-05 9:57 ` [PULL 4/6] gitlab-ci: Fix Avocado cache usage Thomas Huth
2020-08-05 9:57 ` Thomas Huth [this message]
2020-08-05 9:57 ` [PULL 6/6] Get rid of the libqemustub.a remainders Thomas Huth
2020-08-05 10:54 ` [PULL 0/6] Improve gitlab-CI and fix a compiler warning Peter Maydell
2020-08-06 21:52 ` Alistair Francis
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200805095755.16414-6-thuth@redhat.com \
--to=thuth@redhat.com \
--cc=alex.bennee@linaro.org \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).