unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Paul Eggert <eggert@cs.ucla.edu>
To: Stefan Monnier <monnier@iro.umontreal.ca>, emacs-devel@gnu.org
Subject: Re: emacs-26 9e59de9: Use GCALIGNED properly for GCC
Date: Fri, 10 Nov 2017 09:58:03 -0800	[thread overview]
Message-ID: <8d9c169a-5f58-6958-9fca-4c68fa547ba3@cs.ucla.edu> (raw)
In-Reply-To: <jwvvaiiyv6z.fsf-monnier+gmane.emacs.devel@gnu.org>

Stefan Monnier wrote:
>>    union gcaligned_foo { struct foo s; int64_t gcaligned; };
> 
> Are int64_t necessarily aligned on multiples of 8 on 32bit platforms?

No, unfortunately.

>> IOW, should we rely on alignas?  There could be dragons there too, no?
> 
> FWIW, for the dummy alignment thingy I wouldn't use `char` (I wouldn't be
> surprised to see errors in compilers when asking to align on multiples
> of N for objects smaller than N), so maybe
> 
>      #define gc_aligned(typename) \
>         union { typename s; int64_t alignas (GCALIGNMENT) dummy; };

That does not work either, alas, as C11 says 'alignas (8)' is an error when the 
natural alignment of the object is less than 8. This is one of the problems that 
we have encountered in earlier attempts to fix this bug. 'char alignas (8)' 
avoids this problem.

If we run into a platform where alignas (8) does not work either natively or via 
Gnulib emulation, the patch I'm working on has a 'verify' check that should 
result in a build failure. Although I have some ideas for fixing the situation 
if it arises, they would add some complexity (and would depend on the details of 
any problematic hosts), and I'd rather avoid this if possible.



  reply	other threads:[~2017-11-10 17:58 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20171109031206.7056.28312@vcs0.savannah.gnu.org>
     [not found] ` <20171109031208.D2CAF2033E@vcs0.savannah.gnu.org>
2017-11-09 23:31   ` emacs-26 9e59de9: Use GCALIGNED properly for GCC Glenn Morris
2017-11-10  7:10     ` martin rudalics
2017-11-10  8:06       ` Eli Zaretskii
2017-11-10  8:26         ` Paul Eggert
2017-11-10  9:57           ` Eli Zaretskii
2017-11-10 16:23             ` Stefan Monnier
2017-11-10 17:58               ` Paul Eggert [this message]
2017-11-10 18:02                 ` Stefan Monnier
2017-11-10 18:11                   ` Philipp Stephani
2017-11-10 19:19                     ` Paul Eggert
2017-11-10 20:31                       ` Stefan Monnier
2017-11-10 20:45                         ` Paul Eggert
2017-11-11  7:08           ` Paul Eggert
2017-11-11  7:57             ` Paul Eggert
2017-11-11  8:34               ` martin rudalics
2017-11-11  8:50                 ` Paul Eggert
2017-11-11  9:46                   ` martin rudalics
2017-11-11  8:33             ` martin rudalics
2017-11-13 18:19               ` Paul Eggert
2017-11-13 18:45                 ` martin rudalics

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

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8d9c169a-5f58-6958-9fca-4c68fa547ba3@cs.ucla.edu \
    --to=eggert@cs.ucla.edu \
    --cc=emacs-devel@gnu.org \
    --cc=monnier@iro.umontreal.ca \
    /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.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

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).