qemu-riscv.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Richard W.M. Jones" <rjones@redhat.com>
To: qemu-riscv@nongnu.org
Subject: target/riscv: warning on current master: writing 8 bytes into a region of size 4
Date: Thu, 9 Oct 2025 17:25:56 +0100	[thread overview]
Message-ID: <20251009162556.GC5720@redhat.com> (raw)

When compiling the latest master branch, CONFIG_ATOMIC64 is defined,
and I get this warning:

----
In function ‘stq_he_p’,
    inlined from ‘translator_ld’ at ../accel/tcg/translator.c:359:13,
    inlined from ‘translator_ldl_end’ at ../accel/tcg/translator.c:491:10,
    inlined from ‘translator_ldl’ at /home/rjones/d/qemu/include/exec/translator.h:201:12,
    inlined from ‘decode_opc’ at ../target/riscv/translate.c:1236:18,
    inlined from ‘riscv_tr_translate_insn’ at ../target/riscv/translate.c:1348:5:
/home/rjones/d/qemu/include/qemu/bswap.h:295:5: warning: writing 8 bytes into a region of size 4 [-Wstringop-overflow=]
  295 |     __builtin_memcpy(ptr, &v, sizeof(v));
      |     ^
../accel/tcg/translator.c: In function ‘riscv_tr_translate_insn’:
../accel/tcg/translator.c:489:14: note: destination object ‘val’ of size 4
  489 |     uint32_t val;
      |              ^
../accel/tcg/translator.c:489:14: note: at offset [1, 4] into destination object ‘val’ of size 4
----

Looking at the code I can see why it's happening.  However I don't see
a simple fix.

The function 'translator_ldl_end' really wants a 32 bit result, and it
seems like the 64 bit case would never be called, although I'm not
sure ...

Rich.

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
nbdkit - Flexible, fast NBD server with plugins
https://gitlab.com/nbdkit/nbdkit



                 reply	other threads:[~2025-10-09 16:26 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20251009162556.GC5720@redhat.com \
    --to=rjones@redhat.com \
    --cc=qemu-riscv@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).