tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master head: b7b275e60bcd5f89771e865a8239325f86d9927d commit: 295bcca84916cb5079140a89fccb472bb8d1f6e2 linux/bits.h: add compile time sanity check of GENMASK inputs date: 2 years, 8 months ago config: s390-randconfig-r035-20221128 compiler: s390-linux-gcc (GCC) 12.1.0 reproduce (this is a W=1 build): wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross # https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=295bcca84916cb5079140a89fccb472bb8d1f6e2 git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git git fetch --no-tags linus master git checkout 295bcca84916cb5079140a89fccb472bb8d1f6e2 # save the config file mkdir build_dir && cp config build_dir/.config COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=s390 SHELL=/bin/bash drivers/ If you fix the issue, kindly add following tag where applicable | Reported-by: kernel test robot All errors (new ones prefixed by >>): drivers/mux/mmio.c: In function 'mux_mmio_probe': drivers/mux/mmio.c:76:34: error: storage size of 'field' isn't known 76 | struct reg_field field; | ^~~~~ In file included from include/linux/bits.h:23, from include/linux/bitops.h:5, from drivers/mux/mmio.c:8: >> include/linux/bits.h:25:28: error: first argument to '__builtin_choose_expr' not a constant 25 | (BUILD_BUG_ON_ZERO(__builtin_choose_expr( \ | ^~~~~~~~~~~~~~~~~~~~~ include/linux/build_bug.h:16:62: note: in definition of macro 'BUILD_BUG_ON_ZERO' 16 | #define BUILD_BUG_ON_ZERO(e) ((int)(sizeof(struct { int:(-!!(e)); }))) | ^ include/linux/bits.h:39:10: note: in expansion of macro 'GENMASK_INPUT_CHECK' 39 | (GENMASK_INPUT_CHECK(h, l) + __GENMASK(h, l)) | ^~~~~~~~~~~~~~~~~~~ drivers/mux/mmio.c:96:29: note: in expansion of macro 'GENMASK' 96 | if (mask != GENMASK(field.msb, field.lsb)) { | ^~~~~~~ include/linux/build_bug.h:16:51: error: bit-field '' width not an integer constant 16 | #define BUILD_BUG_ON_ZERO(e) ((int)(sizeof(struct { int:(-!!(e)); }))) | ^ include/linux/bits.h:25:10: note: in expansion of macro 'BUILD_BUG_ON_ZERO' 25 | (BUILD_BUG_ON_ZERO(__builtin_choose_expr( \ | ^~~~~~~~~~~~~~~~~ include/linux/bits.h:39:10: note: in expansion of macro 'GENMASK_INPUT_CHECK' 39 | (GENMASK_INPUT_CHECK(h, l) + __GENMASK(h, l)) | ^~~~~~~~~~~~~~~~~~~ drivers/mux/mmio.c:96:29: note: in expansion of macro 'GENMASK' 96 | if (mask != GENMASK(field.msb, field.lsb)) { | ^~~~~~~ drivers/mux/mmio.c:102:29: error: implicit declaration of function 'devm_regmap_field_alloc' [-Werror=implicit-function-declaration] 102 | fields[i] = devm_regmap_field_alloc(dev, regmap, field); | ^~~~~~~~~~~~~~~~~~~~~~~ drivers/mux/mmio.c:76:34: warning: unused variable 'field' [-Wunused-variable] 76 | struct reg_field field; | ^~~~~ cc1: some warnings being treated as errors vim +/__builtin_choose_expr +25 include/linux/bits.h 15 16 /* 17 * Create a contiguous bitmask starting at bit position @l and ending at 18 * position @h. For example 19 * GENMASK_ULL(39, 21) gives us the 64bit vector 0x000000ffffe00000. 20 */ 21 #if !defined(__ASSEMBLY__) && \ 22 (!defined(CONFIG_CC_IS_GCC) || CONFIG_GCC_VERSION >= 49000) 23 #include 24 #define GENMASK_INPUT_CHECK(h, l) \ > 25 (BUILD_BUG_ON_ZERO(__builtin_choose_expr( \ 26 __builtin_constant_p((l) > (h)), (l) > (h), 0))) 27 #else 28 /* 29 * BUILD_BUG_ON_ZERO is not available in h files included from asm files, 30 * disable the input check if that is the case. 31 */ 32 #define GENMASK_INPUT_CHECK(h, l) 0 33 #endif 34 -- 0-DAY CI Kernel Test Service https://01.org/lkp