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) && | ^~ | &
Reported-by: Linux Kernel Functional Testing lkft@linaro.org
Links: - https://qa-reports.linaro.org/lkft/linux-stable-rc-linux-5.15.y/build/v5.15.... - https://qa-reports.linaro.org/lkft/linux-stable-rc-linux-5.15.y/build/v5.15....
Steps to reproduce: tuxmake --runtime podman --target-arch arm --toolchain clang-17 --kconfig davinci_all_defconfig LLVM=1 LLVM_IAS=1
Links: - https://storage.tuxsuite.com/public/linaro/lkft/builds/2TeUCTfH6lMKlORLREGhm...
-- Linaro LKFT https://lkft.linaro.org
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/a84525233776a716e2c6291993f0b33f... 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