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

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



On Sun, Oct 27, 2024 at 7:16 AM Finn Thain <fthain@linux-m68k.org> 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

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

Gr{oetje,eeting}s,

                        Geert

-- 
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds


Reply to: