On Thu, 1 Feb 2024 at 16:34, Andreas Schwab <[email protected]> wrote:
>
> On Feb 01 2024, Jonathan Wakely wrote:
>
> > This will result in an ABI change for targets that use 1-byte alignment
> > for all integral types, e.g. cris-elf.
>
> Or 2-byte alignment as on m68k.
Ah yes.
In fact it's a change for everybody, because previously it was 15 bits
of bit-fields, 1 bit padding, 2 x 16-bit short, 16 bits padding, then
a char32_t, but now it's 15+17 bits of bit-fields, 2x 16-bit short,
char32_t. So the shorts moved internally even if the size didn't
change.
I could make it 15+1 bit-fields, 2x16-bit short, 16 bit-field to avoid
moving the shorts.
template<typename _CharT>
struct _Spec
{
_Align _M_align : 2;
_Sign _M_sign : 2;
unsigned _M_alt : 1;
unsigned _M_localized : 1;
unsigned _M_zero_fill : 1;
_WidthPrec _M_width_kind : 2;
_WidthPrec _M_prec_kind : 2;
_Pres_type _M_type : 4;
unsigned _M_reserved : 1;
unsigned short _M_width;
unsigned short _M_prec;
unsigned _M_reserved2 : 16;
char32_t _M_fill = ' ';
That would also address the PCC_BITFIELD_TYPE_MATTERS point H-P made.