public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
From: Alexander Monakov <amonakov@ispras.ru>
To: "Markus Fröschle" <markus@mubf.de>
Cc: gcc@gcc.gnu.org
Subject: Re: Aw: Re: asking for __attribute__((aligned()) clarification
Date: Wed, 21 Aug 2019 14:29:00 -0000	[thread overview]
Message-ID: <alpine.LNX.2.20.13.1908211714420.32047@monopod.intra.ispras.ru> (raw)
In-Reply-To: <trinity-02ba671e-c260-4ad9-a277-b1169d3026c8-1566279973304@3c-app-1and1-bs05>

[-- Attachment #1: Type: text/plain, Size: 860 bytes --]

On Tue, 20 Aug 2019, "Markus Fröschle" wrote:

> Thank you (and others) for your answers. Now I'm just as smart as before, however.
> 
> Is it a supported, documented, 'long term' feature we can rely on or not?
> 
> If yes, I would expect it to be properly documented. If not, never mind.

I think it's properly documented in gcc-9:

  https://gcc.gnu.org/onlinedocs/gcc-9.2.0/gcc/Common-Type-Attributes.html

(the "old" behavior where the compiler would neither honor reduced alignment
nor issue a warning seems questionable, the new documentation promises a more
sensible approach)

In portable code one can also use memcpy to move unaligned data, the compiler
should translate it like an unaligned load/store when size is a suitable
constant:

  int val;
  memcpy(&val, ptr, sizeof val);

(or __builtin_memcpy when -ffreestanding is in effect)

Alexander

  reply	other threads:[~2019-08-21 14:29 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-19 12:46 "Markus Fröschle"
2019-08-19 13:57 ` Paul Koning
2019-08-19 14:01   ` Richard Earnshaw (lists)
2019-08-19 14:08     ` Alexander Monakov
2019-08-19 14:12       ` Paul Koning
2019-08-20  5:46       ` Aw: " "Markus Fröschle"
2019-08-21 14:29         ` Alexander Monakov [this message]
2019-08-21 14:32           ` Paul Koning
2019-08-21 14:58             ` Alexander Monakov
2019-08-21 16:50               ` Paul Koning
2019-08-21 17:35                 ` Jonathan Wakely

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=alpine.LNX.2.20.13.1908211714420.32047@monopod.intra.ispras.ru \
    --to=amonakov@ispras.ru \
    --cc=gcc@gcc.gnu.org \
    --cc=markus@mubf.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).