This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/82105] unexpected padding in a struct
- From: "rguenth at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Tue, 05 Sep 2017 11:44:19 +0000
- Subject: [Bug c/82105] unexpected padding in a struct
- Auto-submitted: auto-generated
- References: <bug-82105-4@http.gcc.gnu.org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82105
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution|--- |INVALID
--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
This is how bitfields work. You can use
typedef struct __attribute__((packed,aligned(4))) {
unsigned int x:16;
unsigned int y:17;
unsigned short z;
} XXX;
to get what you want.