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: Alexander Lobakin
Date: Mon Mar 17 2025 - 11:35:53 EST
From: Uros Bizjak <ubizjak@xxxxxxxxx>
Date: Sun, 16 Mar 2025 09:28:51 +0100
> 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);
Kbuild bot sometimes fails on randconfigs and random commits blaming
these commits even though they're unrelated.
Esp this function, I dunno why, but time to time on different arches
(um is the winner here) it fails to expand obvious stuff. This for sure
depends on debug stuff configuration, let's say in the attached config I
see KASAN enabled, but not always and it's unclear how to catch and
reproduce stuff (and then how to fix) reliably.
Re Clang and KASAN, there's this in lib/Makefile:
obj-$(CONFIG_TEST_BITMAP) += test_bitmap.o
ifeq ($(CONFIG_CC_IS_CLANG)$(CONFIG_KASAN),yy)
# FIXME: Clang breaks test_bitmap_const_eval when KASAN and GCOV are enabled
GCOV_PROFILE_test_bitmap.o := n
endif
This was added a while ago not by me as I'm no instrumentation expert
and have no idea about those GCOV_PROFILE etc. Does 19.1.7 want more
than that to evaluate obvious things?
>
> Otherwise, the patch fixes a correctness issue, so there is nothing to
> do with the patch anyway.
>
> Uros.
Thanks,
Olek