public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
From: Lars Poeschel <poeschel@lemonage.de>
To: Oleg Endo <oleg.endo@t-online.de>
Cc: gcc-help@gcc.gnu.org
Subject: Re: Unexpected unaligned access on arm
Date: Tue, 9 Jun 2020 10:05:09 +0200	[thread overview]
Message-ID: <20200609080509.dbgs7zizqw7cajvq@lem-wkst-02.lemonage> (raw)
In-Reply-To: <6a8fdf1e93248a8d0c3e651d5bf76ad08aaee15b.camel@t-online.de>

On Mon, Jun 08, 2020 at 10:49:22PM +0900, Oleg Endo wrote:
> On Mon, 2020-06-08 at 15:34 +0200, Lars Poeschel wrote:
> > 
> > What am I missing ? What am I doing wrong ?
> > 
> 
> You're casting an address of some byte array to a point to struct,
> which has an alignment > 1 byte.  Try adding a #pragma pack (1) or
> respective attribute.

Thank you! The pragma does indeed the right thing. gcc now produces
code, that accesses the fields in question individually.
But shouldn't the option
-mno-unaligned-access
I use for compiling also do the same ? Why is this not working ?

Thanks again,
Lars

  reply	other threads:[~2020-06-09  8:05 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-08 13:34 Lars Poeschel
2020-06-08 13:48 ` Alexander Monakov
2020-06-08 13:49 ` Oleg Endo
2020-06-09  8:05   ` Lars Poeschel [this message]
2020-06-09  9:38     ` Andrew Haley

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=20200609080509.dbgs7zizqw7cajvq@lem-wkst-02.lemonage \
    --to=poeschel@lemonage.de \
    --cc=gcc-help@gcc.gnu.org \
    --cc=oleg.endo@t-online.de \
    /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 read-only IMAP folder(s) and NNTP newsgroup(s).