Re: [PATCH] hwmon: (minisforum-um780xtx) Fix clamp() build failure with GCC 11
From: Guenter Roeck
Date: Sun Oct 18 2026 - 12:17:18 EST
On Wed, Oct 14, 2026 at 06:45:22PM -0300, Sebastián Peyrott wrote:
> GCC 11 fails to build the driver:
>
> error: call to '__compiletime_assert_727' declared with attribute error:
> clamp() low limit 0 greater than high limit points[1] - 1
>
> The store function returns -EIO unless points[0] < points[1], so
> points[1] - 1 cannot be negative when the clamp is reached. GCC 11 jump
> threading, however, duplicates the clamp() limit check and does not prune
> the copy in which points[1] is zero, so the compile-time check in clamp()
> fires on an unreachable path. GCC 8 to 10 and 12 to 16 accept the code.
>
> Select both limits first and use a single clamp_val(). This does not
> change behavior.
>
> Fixes: 9d980da93bbc ("hwmon: Add Minisforum UM780 XTX EC monitoring and fan control")
> Reported-by: Paul E. McKenney <paulmck@xxxxxxxxxx>
> Closes: https://lore.kernel.org/r/fda0e59f-20e1-4a94-a714-288940dcdd37@paulmck-laptop
> Assisted-by: LLM
> Signed-off-by: Sebastián Peyrott <speyrott@xxxxxxxxx>
> Tested-by: Paul E. McKenney <paulmck@xxxxxxxxxx>
Folded into original patch, as suggested.
Thanks,
Guenter