Re: [PATCH] compiler.h: Support 64-bit bitwise types in is_signed_type()
From: David Laight
Date: Thu Nov 19 2026 - 18:14:50 EST
On Thu, 19 Nov 2026 10:27:38 -0800
Linus Torvalds <torvalds@xxxxxxxxxxxxxxxxxxxx> wrote:
> On Wed, 18 Nov 2026 at 04:13, David Laight <david.laight.linux@xxxxxxxxx> wrote:
> >
> > The fields ought to be u64 - since that is how they are printed.
>
> ... but then the actual tracing side would be worse and either require
> a stupid and incorrect cast, or actual work to turn it into host byte
> order.
>
> So clearly the printing side doesn't understand about byte order, but
> that's a printing side issue (that nobody really cares abnout:
> big-endian is dead, and good riddance).
>
> That said: I think the right fix might actually be to just allow sign
> extension of the constants 0/-1 inside sparse for bitwise types.
>
> So the sparse warning "cast to restricted __le64" should just be
> suppressed for the values that bitwise types already accept (all ones
> and all zeroes).
I guess if sparse is going to allow the cast at all, it should sign
extend the -1 first - the same as the compiler does.
David
> Because all ones and all zeroes are by definition fine in bitwise
> types. Bit orderign and meaning doesn't matter when all bits are
> equal.
>
> Linus