This version of the patch specifically doesn’t deal with long double. Mostly looking for Jonathan’s review to ensure his previous feedback is addressed. I plan to rev the patch to handle long doubles after some further discussion with you and Jonathan.
On Tue, Nov 2, 2021 at 12:49 AM Jakub Jelinek <ja...@redhat.com> wrote: > On Mon, Nov 01, 2021 at 06:25:45PM -0700, Thomas Rodgers via Gcc-patches > wrote: > > + template<typename _Tp> > > + constexpr bool > > + __maybe_has_padding() > > + { > > +#if __has_builtin(__has_unique_object_representations) > > + return !__has_unique_object_representations(_Tp) > > + && !is_floating_point<_Tp>::value; > > +#else > > + return true; > > +#endif > > I'm not sure I understand the && !is_floating_point<_Tp>::value. > Yes, float and double will never have padding, but long double often > will, e.g. on x86 or ia64 (but e.g. not on ppc, s390x, etc.). > So, unless we want to play with numeric_limits, it should be either > just return !__has_unique_object_representations(_Tp); > or return !__has_unique_object_representations(_Tp) > && (!is_floating_point<_Tp>::value > || is_same<__remove_cv_t<_Tp>,long double>::value); > or, with numeric_limits test numeric_limits<_Tp>::digits == 64 > (but I'm sure Jonathan will not want including such a header dependency > unless it is already included). > Or I can always provide a new __builtin_clear_padding_p ... > > Jakub > >