Re: [PATCH] mm: vmscan: Avoid signedness error for GCC 5.4

David Laight
2025-05-07T20:46:22Z

On Wed, 7 May 2025 10:55:31 +0800
WangYuli <wangyuli@uniontech.com> wrote:

> Hi Matthew Wilcox and Andrew Morton,
>
> On 2025/5/7 00:22, Matthew Wilcox wrote:
> > 1. This has nothing to do with the compiler version; the type-checking
> > is built into min().
>
> Thank you for pointing that out! My previous statement was incorrect.
>
> The error is actually from the __types_ok check within the
> __careful_cmp_once macro failing, which triggered BUILD_BUG_ON.
>
> But then, why do newer compilers compile this without error? Is it
> perhaps because they consider 4U - 1 to be signed?

No, statically_true(tier >= 0) is true even though 'tier' is signed
because the compiler has inlined the function and followed the domain
of 'tier' from the assignments and loops.

David