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

            Bug ID: 64577
           Summary: No -Wpadded warning on padding bitfields
           Product: gcc
           Version: 5.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: chengniansun at gmail dot com

It seems that GCC does not emit -Wpadded warnings on the padding of bit-fields. 



$: cat t.c
struct S1 {
    unsigned f0 : 17;
    unsigned f1 : 17;
};

int main(void) {
    struct S1 s1;
    return 0;
}
$: 
$: gcc-trunk -Wpadded t.c 
t.c:4:1: warning: padding struct size to alignment boundary [-Wpadded]
 };
 ^
$: 
$: clang-trunk -Wpadded t.c 
t.c:3:14: warning: padding struct 'struct S1' with 15 bits to align 'f1'
[-Wpadded]
    unsigned f1 : 17;
             ^
t.c:1:8: warning: padding size of 'struct S1' with 15 bits to alignment
boundary [-Wpadded]
struct S1 {
       ^
2 warnings generated.
$:

Reply via email to