All of lore.kernel.org
 help / color / mirror / Atom feed
From: John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>
To: Peter Maydell <peter.maydell@linaro.org>
Cc: QEMU Developers <qemu-devel@nongnu.org>,
	Richard Henderson <rth@twiddle.net>,
	Knut Omang <knut.omang@oracle.com>
Subject: Re: [Qemu-devel] packed structures and unaligned accesses (sparc)
Date: Tue, 28 Mar 2017 12:19:55 +0200	[thread overview]
Message-ID: <1b4e550d-2a0a-e155-c78e-d6fd0a87cc08@physik.fu-berlin.de> (raw)
In-Reply-To: <CAFEAcA-t7xRo-2CkipmYKE_vUxp8oUBML8ss7G8U_pVhM79H6w@mail.gmail.com>

On 03/27/2017 07:34 PM, Peter Maydell wrote:
> That all makes sense in isolation, but shouldn't something have
> at least warned that "&h.size" isn't actually a uint32_t* in
> the sense of being something you can validly pass to a
> function that takes a uint32_t* ?

It turns out that clang actually emits a warning in this case:

root@deb4g:~# clang-4.0 packed.c -o packed
packed.c:18:18: warning: taking address of packed member 'size' of class or structure 'hdr' may result in an unaligned pointer value
      [-Waddress-of-packed-member]
  return getval(&h.size);
                 ^~~~~~
1 warning generated.
root@deb4g:~#

Adrian

-- 
 .''`.  John Paul Adrian Glaubitz
: :' :  Debian Developer - glaubitz@debian.org
`. `'   Freie Universitaet Berlin - glaubitz@physik.fu-berlin.de
  `-    GPG: 62FF 8A75 84E0 2956 9546  0006 7426 3B37 F5B5 F913

  parent reply	other threads:[~2017-03-28 10:20 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-27 17:34 [Qemu-devel] packed structures and unaligned accesses (sparc) Peter Maydell
2017-03-27 21:43 ` Richard Henderson
2017-03-27 22:13 ` John Paul Adrian Glaubitz
2017-03-28 10:19 ` John Paul Adrian Glaubitz [this message]
2017-03-28 10:23   ` Peter Maydell

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=1b4e550d-2a0a-e155-c78e-d6fd0a87cc08@physik.fu-berlin.de \
    --to=glaubitz@physik.fu-berlin.de \
    --cc=knut.omang@oracle.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=rth@twiddle.net \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.