On Wed, Jul 30, 2025 at 06:52:40PM +0800, Yang Yujie wrote:
> I'm OK with your implementation.  Just curious, do you mean that
> memcmp shouldn't be used on "(x)" at all?

If there are any padding bits with undefined values, yes.
So, e.g. don't use memcmp on addresses of _BitInt vars on
x86_64/i686/aarch64 if it has any padding bits, don't use
memcmp on say addresses of long double on x86_64/i686/m68k
because it has 2 or 6 padding bytes in there, etc.
For some of it, one can use e.g. __builtin_clear_padding.

Talking about that builtin, that makes me wonder if it shouldn't behave
differently for info.extended BITINT_TYPEs.

clear_padding_bitint_needs_padding_p
right now returns false for info.extended, I guess that is ok for
s390x/arm32, but not for the loongarch some padding bits are initialized,
others undefined.

So guess you need to add loongarch support in
clear_padding_bitint_needs_padding_p and in clear_padding_type,
if info.extended and info.limb_mode != info.abi_limb_mode treat the
most significant non-abi limb under the right condition as padding.

        Jakub

Reply via email to