[PATCH 1/2] libstdc++: Replace padding bits with a bit-field in __format::_Spec
Jonathan Wakely
jwakely@redhat.com
Thu Feb 1 17:21:38 GMT 2024
On Thu, 1 Feb 2024 at 17:08, Hans-Peter Nilsson <hp@axis.com> wrote:
>
> > From: Hans-Peter Nilsson <hp@axis.com>
> > Date: Thu, 1 Feb 2024 17:16:47 +0100
>
> > Not speaking for other platforms with default-packed layout
> > or where ABI structure layout alignment implies a change due
> > to PCC_BITFIELD_TYPE_MATTERS and the "unsigned long"
> > bitfield type.
> >
> > That last one may matter though.
>
> > > diff --git a/libstdc++-v3/include/std/format b/libstdc++-v3/include/std/format
> > > index 0eca8b58bfa..6c958bc11a5 100644
> > > --- a/libstdc++-v3/include/std/format
> > > +++ b/libstdc++-v3/include/std/format
> > > @@ -406,6 +406,7 @@ namespace __format
> > > _WidthPrec _M_width_kind : 2;
> > > _WidthPrec _M_prec_kind : 2;
> > > _Pres_type _M_type : 4;
> > > + unsigned long _M_reserved : 17;
>
> FAOD (no doubt you got this already, but...)
>
> I'd suggest making that "unsigned long" only for 16-bitters (i.e. where
> you'd need a type larger than "unsigned int" to cover 17 bits) and
> "unsigned" elsewhere, so at least you have no impact from
> PCC_BITFIELD_TYPE_MATTERS.
Ah, I have never heard of that. I guess using uint32_t would be OK.
More information about the Libstdc++
mailing list