emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: emacs-26 9e59de9: Use GCALIGNED properly for GCC


From: Paul Eggert
Subject: Re: emacs-26 9e59de9: Use GCALIGNED properly for GCC
Date: Fri, 10 Nov 2017 00:26:19 -0800
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.4.0

Eli Zaretskii wrote:
Paul, maybe we should simply go back a few notches and not mark
main_thread as GCALIGNED, except on that single platform which needed
it (i.e. via #ifdef)?  Then we could return all the other symbols to
their previous syntax.

Or maybe we should move GCALIGNED to yet another position, like at the
beginning or the end of the whole construct.  Like this:

    GCALIGNED struct foo FOO;
or
    struct foo FOO GCALIGNED;

Not sure what else can we do, but this seems to be an exceptionally
fragile feature, at least with GCC 7 that many people are using.

I've investigated this further, and neither solution is likely to work. It is merely the luck of the draw that we have seen the bug only on that platform so far, and a similar bug is likely to occur on other platforms. Neither GCALIGNED syntax works in general (see GCC bug 82914) and we've seen examples of failures with either syntax.

I have thought of a solution that fixes the problem by dropping use of GCALIGNED and instead using classic C unions along with 'char alignas (8)'. The idea is to gcalign a 'struct foo' this way:

   union gcaligned_foo { struct foo s; char alignas (8) gcaligned; };

Something like this should work on all platforms that Emacs ports to. I plan to work on a first cut tomorrow.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]