#2375·ghidra

m68000: wrong alignment for structure members

Author: th-ottoCreated Oct 17, 2020Updated Sep 14, 2026
LabelsType: BugFeature: Processor/68000Status: Internal

On m68k, the alignment of all types >= 2 bytes should be 2, not 4 as specified in 68000.cspec. To verify:

$ cat foo.c
struct foo {
        short x;
        double y;
};

int x = __builtin_offsetof(struct foo, y);

$ m68k-elf-gcc -S -o - foo.c
x:
        .long   2
        .ident  "GCC: (GNU) 10.0.1 20200501 (prerelease)"

The value of the global variable "x" there is 2. That would be the case also for other types of y in the structure.

Source: NationalSecurityAgency/ghidra