On Thu, 1 Feb 2024 at 17:22, Jonathan Wakely <jwak...@redhat.com> wrote: > > On Thu, 1 Feb 2024 at 16:34, Andreas Schwab <sch...@suse.de> 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.
Oh, and I forgot to mention in the first email that I already changed the ABI of that type in r14-6991-g37a4c5c23a270c so it's already different from gcc-13 anyway. I think I'd prefer to keep the reserved bits together, but a simpler way to avoid 'unsigned long' making a difference for PCC_BITFIELD_TYPE_MATTERS targets would be to use no more than 16 bits but do: unsigned _M_reserved : 1; unsigned _M_reserved2 : 16;