Bug#442854: hex-a-hop: [m68k] FTBFS: packfile.h:57: error: size of array 'static_assert1' is negative

Geert Uytterhoeven geert at linux-m68k.org
Wed Sep 19 07:03:18 UTC 2007

On Wed, 19 Sep 2007, Jens Seidel wrote:
> Could you please help me resolving a problem on the m68k architecture?
> I'm the maintainer of hex-a-hop, a funny SDL game, which was mainly
> written for i386. During my attempts to make it big endian clean I also
> added a static assert test which aim was to check for proper alignment
> of a data structure.
> I think my test sizeof(Entry)==8 is wrong as it failed on m68k.
> Nevertheless I'm nearly sure that this platform doesn't align a char[1]
> array on 64 bit boundaries so the code should work :-)

> typedef struct Entry {
>   int32_t len;
>   // could there be an alignment gap here?
>   char name[1];
> } Entry;

On m68k, 32-bit quantities must be aligned to 2 bytes.
Since sizeof() of a struct always gives a value that's a multiple of the
maximum alignment of the individual fields of the struct, you get 6 (5
rounded up to a multiple of 2).



Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert at 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

More information about the Pkg-games-devel mailing list