<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/131647>131647</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            [clang] -Wpadded-bitfield warns a wrong number of padded bytes with ms_struct
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          therealcoochieman
      </td>
    </tr>
</table>

<pre>
    For the following struct:
```c
struct __attribute__((ms_struct)) Foo {
  long long x;
  char a : 1;
  long long b : 1;
};
```

We should have a padding of 63 bits between `a` and `b` as the compiler aims for an 8 byte alignment, with `a` taking 1 bit and `b` having a different underlying type.

The following command `clang -Wpaded foo.cc` gives out the following warning:
```
test.cc:4:13: warning: padding struct 'Foo' with 7 bytes to align 'yy' [-Wpadded-bitfield]
    4 |   long long yy : 1;
      | ^
test.cc:1:35: warning: padding size of 'Foo' with 63 bits to alignment boundary [-Wpadded]
    1 | struct __attribute__((ms_struct)) Foo {
      | ^
```

>From my understanding, something is wrong with the way the alignment warning for `-Wpadded-bitfield` is computed. Can somebody confirm this?

If confirmed, I would like to work on this issue.
 
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJycVE9v-ygQ_TT4MmqEwX-Sgw9uu5Z-95V-xwgMttliiAAn6_30K7DTNK32slFkI2aYefPew8x7NRopG1S-ovI9Y0uYrGvCJJ1kure2n5Scmcm4FWvTWQdhkjBYre1NmRF8cEsfEG0RblGFt3-PcLsF4HxmITjFlyDPZ0SOiBxnf95PkRMiJ-isBVS_ItwCaGvG7fE3ottWPzEHDBBtIb_vPdL41wCq3_fFHUlc4_a3BD_ZRQuY2FUCgwsTIqK3A1QUuAoeuAw3KQ2gCjNUYWBGxDVPa5-m7u18UVo6YGr2MFgHzMAR-BokMK1GM0sTEHmDmwrTZ6HAPmKrPLZ5qjqxawwwEGoYpJMmwGKEdHqN22G9yMMG_88nxns7z3uZXjMzwsvvCxNSwGDtoe9j5VFdpQe7hG9i3Zgzyozf1EK4DdKHeJa2BaJtTiOnj-RPunZNEak7axGpt0HrxICHYDcWYnxdYxiVrwmckOKFqzAoqQUq35OEAAWg-g2-irmuzzLHX8xB5R9PIHNEW1r-F0j1j4zCfkN51_mOMmoF3C5GMLd-RfoAmKfm_8_Iz9C_-bFzdoZ53eT2gZkIPBrH21mGKU6hPNxc5CSBjzLe2JreD_T78MmJqMI_qa5wrBNtuwQpDvDGTGoR7zL01gzKzRAm5RHtNmS_hvu-FBHQL7ile6PVh4zU3az7AGvSIVDeL8mjkImGihM9sUw2eV0QQsmxwtnUVPyY5yKPoSMTJ5JjXvW0pAXDed2feKYagkmJaV7nNS0IPpTHXhRUDLzOjxwzggosZ6b0QevrfLBuzFLbJqd5VdSZZlxqf_96uSZmvfBl9KjAWvngH-eCCjp959K1QeU7_GAsUeqB7dybZebSRTNtebvRkySf4meL080UwsXHe0U6RLpRhWnhh97OiHSx__56uTj7l4x-6dIQHpFun-PakH8DAAD__36MvxY">