This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: gcc vs clang for non-power-2 atomic structures


On Fri, 23 Aug 2019, 11:13 Iain Sandoe, <idsandoe@googlemail.com> wrote:
>
>
> > On 23 Aug 2019, at 10:35, Jonathan Wakely <jwakely.gcc@gmail.com> wrote:
> >
> > On Fri, 23 Aug 2019 at 08:21, Iain Sandoe <idsandoe@googlemail.com> wrote:
> >>
> >> Hi Jim,
> >>
> >>> On 23 Aug 2019, at 00:56, Jim Wilson <jimw@sifive.com> wrote:
> >>>
> >>> We got a change request for the RISC-V psABI to define the atomic
> >>> structure size and alignment.  And looking at this, it turned out that
> >>> gcc and clang are implementing this differently.  Consider this
> >>> testcase
> >>>
> >>> rohan:2274$ cat tmp.c
> >>> #include <stdio.h>
> >>> struct s { int a; int b; int c;};
> >>> int
> >>> main(void)
> >>> {
> >>> printf("size=%ld align=%ld\n", sizeof (struct s), _Alignof(struct s));
> >>> printf("size=%ld align=%ld\n", sizeof (_Atomic (struct s)),
> >>> _Alignof(_Atomic (struct s)));
> >>> return 0;
> >>> }
> >>> rohan:2275$ gcc tmp.c
> >>> rohan:2276$ ./a.out
> >>> size=12 align=4
> >>> size=12 align=4
> >>> rohan:2277$ clang tmp.c
> >>> rohan:2278$ ./a.out
> >>> size=12 align=4
> >>> size=16 align=16
> >>> rohan:2279$
> >>>
> >>> This is with an x86 compiler.
> >>
> >> A search for _Atomic in the latest (x86_64) psABI document shows no results.
> >
> > See https://groups.google.com/forum/#!topic/ia32-abi/Tlu6Hs-ohPY and
> > the various GCC bugs linked to from that thread.
> >
> > This is a big can of worms, and GCC needs fixing (but probably not
> > until the ABI group decide something).
>
> I agree about the size of the can of worms.
> However, there doesn’t seem to be any actual issue filed on:
> https://github.com/hjl-tools/x86-psABI
>
> Would it help if someone did?


Is that for IA-32 as well, or only x86-64 and x32? I thought the
Google group was the right place for IA-32 issues, and that would then
get picked up by the x86-64 psABI too. But I don't know. It would be
helpful if these things weren't spread around over so many different
locations with no actual fixes happening.

Just to confuse me further, the wiki at that GitHub repo says to go to gitlab!

"All x86-64 psABI changes should be sent to
https://gitlab.com/x86-psABIs/x86-64-ABI.";

It feels like nobody cares about fixing this.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]