[Bug c++/87373] Packed structs are not handled properly on ARM architecture even with misaligned access is enabled

rearnsha at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Fri Sep 21 15:28:00 GMT 2018


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87373

--- Comment #21 from Richard Earnshaw <rearnsha at gcc dot gnu.org> ---
(In reply to Murat Ursavaş from comment #20)
> By the way, the hardware peripheral registers are aligned to 32bits.

So why don't you define your struct as

struct TestStructType
{
    volatile unsigned one;
    unsigned char two;
    unsigned short three __attribute__((packed));
};

And get rid of the pragma entirely?


More information about the Gcc-bugs mailing list