[Bug c++/87373] Packed structs are not handled properly on ARM architecture even with misaligned access is enabled
murat.ursavas at gmail dot com
gcc-bugzilla@gcc.gnu.org
Sat Sep 22 07:52:00 GMT 2018
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87373
--- Comment #26 from Murat Ursavaş <murat.ursavas at gmail dot com> ---
(In reply to Richard Earnshaw from comment #21)
> (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?
Richard,
Some of the structs are not under my control, since they belong to manufacturer
libraries. I need pack-1 for some due to storage and communication needs.
And I didn't know that I could pack individual struct members. Please correct
me if I'm wrong. This structs size is total 10 bytes, one:4, two:4 and three:2,
right?
More information about the Gcc-bugs
mailing list