Re: stable-rc 5.15: clang-17: davinci_all_defconfig failed - arch/arm/include/asm/tlbflush.h:420:85: error: use of logical '&&' with constant operand [-Werror,-Wconstant-logical-operand]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Naresh,

On Tue, Aug 08, 2023 at 11:52:12AM +0530, Naresh Kamboju wrote:
> LKFT build plans upgraded to clang-17 and found this failure,
> 
> While building stable-rc 5.15 arm davinci_all_defconfig with clang-17 failed
> with below warnings and errors.
> 
> Build log:
> ----------
> 
> arch/arm/include/asm/tlbflush.h:420:85: error: use of logical '&&'
> with constant operand [-Werror,-Wconstant-logical-operand]
>   420 |         if (possible_tlb_flags &
> (TLB_V4_U_PAGE|TLB_V4_D_PAGE|TLB_V4_I_PAGE|TLB_V4_I_FULL) &&
>       |
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> ^
> arch/arm/include/asm/tlbflush.h:420:85: note: use '&' for a bitwise operation
>   420 |         if (possible_tlb_flags &
> (TLB_V4_U_PAGE|TLB_V4_D_PAGE|TLB_V4_I_PAGE|TLB_V4_I_FULL) &&
>       |
>                             ^~
>       |
>                             &

Thanks for the report. This is "fixed" in mainline with commit
cb32c285cc10 ("cpumask: change return types to bool where appropriate"),
which causes the warning not to fire because the right hand side is a
boolean, rather than an integer. That change picks cleanly back to at
least 5.4 with commit 1dc01abad654 ("cpumask: Always inline helpers
which use bit manipulation functions") applied before it.

However, the change to -Wconstant-logical-operand in clang that causes
this in the first place is being reverted in both clang-18 and clang-17,
so this will disappear shortly:

https://github.com/llvm/llvm-project/commit/a84525233776a716e2c6291993f0b33fd1c76f7c
https://github.com/llvm/llvm-project/issues/64515

There is some discussion about the warning coming back and the suggested
change to the warning does not seem like it fix this instance so
applying those couple of changes may not be a bad idea anyways:

https://github.com/llvm/llvm-project/issues/64356

Cheers,
Nathan



[Index of Archives]     [Linux Kernel]     [Kernel Development Newbies]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite Hiking]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux