Re: Plan needed for switching m68k to 32-bit alignment

Finn Thain <[email protected]>
Newsgroups gmane.linux.ports.m68k,gmane.linux.debian.ports.68k
Message-ID <[email protected]>
On Thu, 14 Nov 2024, Geert Uytterhoeven wrote:

> On Sun, Oct 27, 2024 at 7:16 AM Finn Thain <[email protected]> wrote:
> > On Sun, 27 Oct 2024, Thorsten Glaser wrote:
> > > Finn Thain dixit:
> > >
> > > >That would mean __alignof__(foo.b) == sizeof(foo.b) but that's not the
> > > >case on my Linux/i686 system. 4 != 8:
> > > >
> > > >struct baa {
> > > >        int a;
> > > >        long long b;
> > > >} foo;
> > >
> > > That struct is just 12 bytes for you then?
> >
> > Right. i686 and m68k agree on that.
> 
> On i686 (i.e. gcc -m32 on amd64):
> 
>     __alignof__(long long) = 8
> 
> but
> 
>     sizeof(struct baa) = 12
>     __alignof__(struct baa) = 4
> 
> ???

My i686 compiler agrees with your compiler. Whereas on Linux/m68k, 
__alignof__(struct baa) == 2. On NetBSD/m68k I get,

sizeof(struct baa) == 16
__alignof__(long long) == 8
__alignof__(struct baa) == 8

> Isn't the alignment of a struct the largest alignment of any of its members?
> 

Sometimes...
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.