linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* include/linux/bits.h:25:21: error: first argument to '__builtin_choose_expr' not a constant
@ 2020-08-08  0:03 kernel test robot
  2020-08-11  4:27 ` Andrew Morton
  0 siblings, 1 reply; 3+ messages in thread
From: kernel test robot @ 2020-08-08  0:03 UTC (permalink / raw)
  To: Rikard Falkeborn
  Cc: kbuild-all, linux-kernel, Andrew Morton,
	Linux Memory Management List, Masahiro Yamada, Kees Cook

[-- Attachment #1: Type: text/plain, Size: 4115 bytes --]

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   30185b69a2d533c4ba6ca926b8390ce7de495e29
commit: 295bcca84916cb5079140a89fccb472bb8d1f6e2 linux/bits.h: add compile time sanity check of GENMASK inputs
date:   4 months ago
config: s390-randconfig-r001-20200808 (attached as .config)
compiler: s390-linux-gcc (GCC) 9.3.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
        git checkout 295bcca84916cb5079140a89fccb472bb8d1f6e2
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=s390 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All errors (new ones prefixed by >>):

   drivers/mux/mmio.c: In function 'mux_mmio_probe':
   drivers/mux/mmio.c:76:20: 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:21: 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:3: note: in expansion of macro 'GENMASK_INPUT_CHECK'
      39 |  (GENMASK_INPUT_CHECK(h, l) + __GENMASK(h, l))
         |   ^~~~~~~~~~~~~~~~~~~
   drivers/mux/mmio.c:96:15: note: in expansion of macro 'GENMASK'
      96 |   if (mask != GENMASK(field.msb, field.lsb)) {
         |               ^~~~~~~
   include/linux/build_bug.h:16:51: error: bit-field '<anonymous>' width not an integer constant
      16 | #define BUILD_BUG_ON_ZERO(e) ((int)(sizeof(struct { int:(-!!(e)); })))
         |                                                   ^
   include/linux/bits.h:25:3: note: in expansion of macro 'BUILD_BUG_ON_ZERO'
      25 |  (BUILD_BUG_ON_ZERO(__builtin_choose_expr( \
         |   ^~~~~~~~~~~~~~~~~
   include/linux/bits.h:39:3: note: in expansion of macro 'GENMASK_INPUT_CHECK'
      39 |  (GENMASK_INPUT_CHECK(h, l) + __GENMASK(h, l))
         |   ^~~~~~~~~~~~~~~~~~~
   drivers/mux/mmio.c:96:15: note: in expansion of macro 'GENMASK'
      96 |   if (mask != GENMASK(field.msb, field.lsb)) {
         |               ^~~~~~~
   drivers/mux/mmio.c:102:15: 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:20: 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 <linux/build_bug.h>
    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, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 16339 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: include/linux/bits.h:25:21: error: first argument to '__builtin_choose_expr' not a constant
  2020-08-08  0:03 include/linux/bits.h:25:21: error: first argument to '__builtin_choose_expr' not a constant kernel test robot
@ 2020-08-11  4:27 ` Andrew Morton
  2020-08-12 13:37   ` Peter Rosin
  0 siblings, 1 reply; 3+ messages in thread
From: Andrew Morton @ 2020-08-11  4:27 UTC (permalink / raw)
  To: kernel test robot
  Cc: Rikard Falkeborn, kbuild-all, linux-kernel,
	Linux Memory Management List, Masahiro Yamada, Kees Cook,
	Peter Rosin

On Sat, 8 Aug 2020 08:03:38 +0800 kernel test robot <lkp@intel.com> wrote:

> tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
> head:   30185b69a2d533c4ba6ca926b8390ce7de495e29
> commit: 295bcca84916cb5079140a89fccb472bb8d1f6e2 linux/bits.h: add compile time sanity check of GENMASK inputs
> date:   4 months ago
> config: s390-randconfig-r001-20200808 (attached as .config)
> compiler: s390-linux-gcc (GCC) 9.3.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
>         git checkout 295bcca84916cb5079140a89fccb472bb8d1f6e2
>         # save the attached .config to linux build tree
>         COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=s390 
> 
> If you fix the issue, kindly add following tag as appropriate
> Reported-by: kernel test robot <lkp@intel.com>
> 
> All errors (new ones prefixed by >>):
> 
>    drivers/mux/mmio.c: In function 'mux_mmio_probe':
>    drivers/mux/mmio.c:76:20: 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:21: error: first argument to '__builtin_choose_expr' not a constant

I assume the first error is the cause of the second?

struct reg_field is only defined if CONFIG_REGMAP, and that is unset in
this .config.  Perhaps drivers/mux/mmio.c should depend on
CONFIG_REGMAP?  (cc Peter).



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: include/linux/bits.h:25:21: error: first argument to '__builtin_choose_expr' not a constant
  2020-08-11  4:27 ` Andrew Morton
@ 2020-08-12 13:37   ` Peter Rosin
  0 siblings, 0 replies; 3+ messages in thread
From: Peter Rosin @ 2020-08-12 13:37 UTC (permalink / raw)
  To: Andrew Morton, kernel test robot
  Cc: Rikard Falkeborn, kbuild-all, linux-kernel,
	Linux Memory Management List, Masahiro Yamada, Kees Cook

On 2020-08-11 06:27, Andrew Morton wrote:
> On Sat, 8 Aug 2020 08:03:38 +0800 kernel test robot <lkp@intel.com> wrote:
> 
>> tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
>> head:   30185b69a2d533c4ba6ca926b8390ce7de495e29
>> commit: 295bcca84916cb5079140a89fccb472bb8d1f6e2 linux/bits.h: add compile time sanity check of GENMASK inputs
>> date:   4 months ago
>> config: s390-randconfig-r001-20200808 (attached as .config)
>> compiler: s390-linux-gcc (GCC) 9.3.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
>>         git checkout 295bcca84916cb5079140a89fccb472bb8d1f6e2
>>         # save the attached .config to linux build tree
>>         COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=s390 
>>
>> If you fix the issue, kindly add following tag as appropriate
>> Reported-by: kernel test robot <lkp@intel.com>
>>
>> All errors (new ones prefixed by >>):
>>
>>    drivers/mux/mmio.c: In function 'mux_mmio_probe':
>>    drivers/mux/mmio.c:76:20: 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:21: error: first argument to '__builtin_choose_expr' not a constant
> 
> I assume the first error is the cause of the second?
> 
> struct reg_field is only defined if CONFIG_REGMAP, and that is unset in
> this .config.  Perhaps drivers/mux/mmio.c should depend on
> CONFIG_REGMAP?  (cc Peter).
> 
> 

Thanks for the CC, and yes, that sounds about right. If it shouldn't
just "select REGMAP" instead?

I'm not sure when one should "select" and when one should "depends on"?

Cheers,
Peter

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-08-12 13:37 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-08  0:03 include/linux/bits.h:25:21: error: first argument to '__builtin_choose_expr' not a constant kernel test robot
2020-08-11  4:27 ` Andrew Morton
2020-08-12 13:37   ` Peter Rosin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).