Re: [tip:x86/asm 3/7] lib/test_bitmap.c:1269:2: error: call to '__compiletime_assert_279' declared with 'error' attribute: BUILD_BUG_ON failed: !__builtin_constant_p(res)

From: Uros Bizjak
Date: Sun Mar 16 2025 - 04:29:06 EST


On Sun, Mar 16, 2025 at 3:52 AM kernel test robot <lkp@xxxxxxxxx> wrote:
>
> tree: https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git x86/asm
> head: 9628d19e91f1ef9e7b1321e74a88bfa646d2a8d3
> commit: 01ba23bf1b3f9a4035faedc2aa450e251bcc2c7c [3/7] x86/hweight: Use ASM_CALL_CONSTRAINT in inline asm()
> config: x86_64-buildonly-randconfig-003-20250316 (https://download.01.org/0day-ci/archive/20250316/202503161004.ZmMcxxeB-lkp@xxxxxxxxx/config)
> compiler: clang version 19.1.7 (https://github.com/llvm/llvm-project cd708029e0b2869e80abe31ddb175f7c35361f90)
> rustc: rustc 1.78.0 (9b00956e5 2024-04-29)
> reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250316/202503161004.ZmMcxxeB-lkp@xxxxxxxxx/reproduce)
>
> If you fix the issue in a separate patch/commit (i.e. not just a new version of
> the same patch/commit), kindly add following tags
> | Reported-by: kernel test robot <lkp@xxxxxxxxx>
> | Closes: https://lore.kernel.org/oe-kbuild-all/202503161004.ZmMcxxeB-lkp@xxxxxxxxx/
>
> All errors (new ones prefixed by >>):
>
> >> lib/test_bitmap.c:1269:2: error: call to '__compiletime_assert_279' declared with 'error' attribute: BUILD_BUG_ON failed: !__builtin_constant_p(res)
> 1269 | BUILD_BUG_ON(!__builtin_constant_p(res));

I fail to see how the referred patch can cause an error in:

/* !(BIT(31) & BIT(18)) == 1 */
res = !test_bit(18, &bitopvar);
BUILD_BUG_ON(!__builtin_constant_p(res));
BUILD_BUG_ON(!res);

Otherwise, the patch fixes a correctness issue, so there is nothing to
do with the patch anyway.

Uros.