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

            Bug ID: 82105
           Summary: unexpected padding in a struct
           Product: gcc
           Version: 5.4.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: dudu.arbel at ilrd dot co.il
  Target Milestone: ---

There is an unexpected padding (of 2 bytes) between x and y in the following
struct.
This causes it to be of size 12 bytes, although 8 bytes should be enough.
This behavior seems inconsistent to many other examples (e.g - reducing x size
to 15, eliminates the padding)

typedef struct {
        unsigned int x:16;
        unsigned int y:17;
        unsigned short z;
} XXX;

Reply via email to