include/linux/compiler.h:245:77: error: expression in static assertion is not an integer

From: kernel test robot
Date: Sat Jun 07 2025 - 02:19:28 EST


tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 119b1e61a769aa98e68599f44721661a4d8c55f3
commit: d7a516c6eeae29144649f1c3f586fa580ec9e040 compiler.h: Fix undefined BUILD_BUG_ON_ZERO()
date: 7 months ago
config: loongarch-randconfig-r053-20250607 (https://download.01.org/0day-ci/archive/20250607/202506071446.bj4cB7D2-lkp@xxxxxxxxx/config)
compiler: loongarch64-linux-gcc (GCC) 12.4.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250607/202506071446.bj4cB7D2-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/202506071446.bj4cB7D2-lkp@xxxxxxxxx/

All errors (new ones prefixed by >>):

In file included from include/linux/lockdep.h:15,
from include/linux/mutex.h:17,
from include/linux/kernfs.h:11,
from include/linux/sysfs.h:16,
from include/linux/kobject.h:20,
from include/linux/pci.h:35,
from sound/pci/ad1889.c:24:
arch/loongarch/include/asm/percpu.h:20:4: error: #error compiler support for the model attribute is necessary when a recent assembler is used
20 | # error compiler support for the model attribute is necessary when a recent assembler is used
| ^~~~~
In file included from include/linux/build_bug.h:5,
from include/linux/init.h:5,
from sound/pci/ad1889.c:23:
>> include/linux/compiler.h:245:77: error: expression in static assertion is not an integer
245 | #define __BUILD_BUG_ON_ZERO_MSG(e, msg) ((int)sizeof(struct {_Static_assert(!(e), msg);}))
| ^
include/linux/compiler.h:249:33: note: in expansion of macro '__BUILD_BUG_ON_ZERO_MSG'
249 | #define __must_be_array(a) __BUILD_BUG_ON_ZERO_MSG(__same_type((a), &(a)[0]), "must be array")
| ^~~~~~~~~~~~~~~~~~~~~~~
include/linux/array_size.h:11:59: note: in expansion of macro '__must_be_array'
11 | #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) + __must_be_array(arr))
| ^~~~~~~~~~~~~~~
include/linux/moduleparam.h:521:20: note: in expansion of macro 'ARRAY_SIZE'
521 | = { .max = ARRAY_SIZE(array), .num = nump, \
| ^~~~~~~~~~
include/linux/moduleparam.h:505:9: note: in expansion of macro 'module_param_array_named'
505 | module_param_array_named(name, name, type, nump, perm)
| ^~~~~~~~~~~~~~~~~~~~~~~~
sound/pci/ad1889.c:48:1: note: in expansion of macro 'module_param_array'
48 | module_param_array(index, int, NULL, 0444);
| ^~~~~~~~~~~~~~~~~~
sound/pci/ad1889.c:47:12: warning: 'index' defined but not used [-Wunused-variable]
47 | static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX;
| ^~~~~
--
In file included from include/linux/irqflags.h:19,
from include/linux/spinlock.h:59,
from include/linux/sched.h:2140,
from include/linux/delay.h:23,
from sound/pci/cmipci.c:11:
arch/loongarch/include/asm/percpu.h:20:4: error: #error compiler support for the model attribute is necessary when a recent assembler is used
20 | # error compiler support for the model attribute is necessary when a recent assembler is used
| ^~~~~
In file included from include/linux/build_bug.h:5,
from include/linux/init.h:5,
from include/linux/io.h:11,
from sound/pci/cmipci.c:10:
>> include/linux/compiler.h:245:77: error: expression in static assertion is not an integer
245 | #define __BUILD_BUG_ON_ZERO_MSG(e, msg) ((int)sizeof(struct {_Static_assert(!(e), msg);}))
| ^
include/linux/compiler.h:249:33: note: in expansion of macro '__BUILD_BUG_ON_ZERO_MSG'
249 | #define __must_be_array(a) __BUILD_BUG_ON_ZERO_MSG(__same_type((a), &(a)[0]), "must be array")
| ^~~~~~~~~~~~~~~~~~~~~~~
include/linux/array_size.h:11:59: note: in expansion of macro '__must_be_array'
11 | #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) + __must_be_array(arr))
| ^~~~~~~~~~~~~~~
include/linux/moduleparam.h:521:20: note: in expansion of macro 'ARRAY_SIZE'
521 | = { .max = ARRAY_SIZE(array), .num = nump, \
| ^~~~~~~~~~
include/linux/moduleparam.h:505:9: note: in expansion of macro 'module_param_array_named'
505 | module_param_array_named(name, name, type, nump, perm)
| ^~~~~~~~~~~~~~~~~~~~~~~~
sound/pci/cmipci.c:48:1: note: in expansion of macro 'module_param_array'
48 | module_param_array(index, int, NULL, 0444);
| ^~~~~~~~~~~~~~~~~~
sound/pci/cmipci.c:38:12: warning: 'index' defined but not used [-Wunused-variable]
38 | static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */
| ^~~~~
--
In file included from include/linux/irqflags.h:19,
from include/linux/spinlock.h:59,
from include/linux/sched.h:2140,
from include/linux/delay.h:23,
from sound/pci/cs4281.c:8:
arch/loongarch/include/asm/percpu.h:20:4: error: #error compiler support for the model attribute is necessary when a recent assembler is used
20 | # error compiler support for the model attribute is necessary when a recent assembler is used
| ^~~~~
In file included from include/linux/build_bug.h:5,
from include/linux/init.h:5,
from include/linux/io.h:11,
from sound/pci/cs4281.c:7:
>> include/linux/compiler.h:245:77: error: expression in static assertion is not an integer
245 | #define __BUILD_BUG_ON_ZERO_MSG(e, msg) ((int)sizeof(struct {_Static_assert(!(e), msg);}))
| ^
include/linux/compiler.h:249:33: note: in expansion of macro '__BUILD_BUG_ON_ZERO_MSG'
249 | #define __must_be_array(a) __BUILD_BUG_ON_ZERO_MSG(__same_type((a), &(a)[0]), "must be array")
| ^~~~~~~~~~~~~~~~~~~~~~~
include/linux/array_size.h:11:59: note: in expansion of macro '__must_be_array'
11 | #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) + __must_be_array(arr))
| ^~~~~~~~~~~~~~~
include/linux/moduleparam.h:521:20: note: in expansion of macro 'ARRAY_SIZE'
521 | = { .max = ARRAY_SIZE(array), .num = nump, \
| ^~~~~~~~~~
include/linux/moduleparam.h:505:9: note: in expansion of macro 'module_param_array_named'
505 | module_param_array_named(name, name, type, nump, perm)
| ^~~~~~~~~~~~~~~~~~~~~~~~
sound/pci/cs4281.c:34:1: note: in expansion of macro 'module_param_array'
34 | module_param_array(index, int, NULL, 0444);
| ^~~~~~~~~~~~~~~~~~
sound/pci/cs4281.c:29:12: warning: 'index' defined but not used [-Wunused-variable]
29 | static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */
| ^~~~~
--
In file included from include/linux/irqflags.h:19,
from include/linux/spinlock.h:59,
from include/linux/sched.h:2140,
from include/linux/delay.h:23,
from sound/pci/fm801.c:7:
arch/loongarch/include/asm/percpu.h:20:4: error: #error compiler support for the model attribute is necessary when a recent assembler is used
20 | # error compiler support for the model attribute is necessary when a recent assembler is used
| ^~~~~
In file included from include/asm-generic/div64.h:27,
from ./arch/loongarch/include/generated/asm/div64.h:1,
from include/linux/math.h:6,
from include/linux/delay.h:22:
>> include/linux/compiler.h:245:77: error: expression in static assertion is not an integer
245 | #define __BUILD_BUG_ON_ZERO_MSG(e, msg) ((int)sizeof(struct {_Static_assert(!(e), msg);}))
| ^
include/linux/compiler.h:249:33: note: in expansion of macro '__BUILD_BUG_ON_ZERO_MSG'
249 | #define __must_be_array(a) __BUILD_BUG_ON_ZERO_MSG(__same_type((a), &(a)[0]), "must be array")
| ^~~~~~~~~~~~~~~~~~~~~~~
include/linux/array_size.h:11:59: note: in expansion of macro '__must_be_array'
11 | #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) + __must_be_array(arr))
| ^~~~~~~~~~~~~~~
include/linux/moduleparam.h:521:20: note: in expansion of macro 'ARRAY_SIZE'
521 | = { .max = ARRAY_SIZE(array), .num = nump, \
| ^~~~~~~~~~
include/linux/moduleparam.h:505:9: note: in expansion of macro 'module_param_array_named'
505 | module_param_array_named(name, name, type, nump, perm)
| ^~~~~~~~~~~~~~~~~~~~~~~~
sound/pci/fm801.c:44:1: note: in expansion of macro 'module_param_array'
44 | module_param_array(index, int, NULL, 0444);
| ^~~~~~~~~~~~~~~~~~
sound/pci/fm801.c:30:12: warning: 'index' defined but not used [-Wunused-variable]
30 | static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */
| ^~~~~
--
In file included from include/linux/irqflags.h:19,
from include/linux/spinlock.h:59,
from include/linux/sched.h:2140,
from include/linux/delay.h:23,
from sound/pci/rme32.c:58:
arch/loongarch/include/asm/percpu.h:20:4: error: #error compiler support for the model attribute is necessary when a recent assembler is used
20 | # error compiler support for the model attribute is necessary when a recent assembler is used
| ^~~~~
In file included from include/asm-generic/div64.h:27,
from ./arch/loongarch/include/generated/asm/div64.h:1,
from include/linux/math.h:6,
from include/linux/delay.h:22:
>> include/linux/compiler.h:245:77: error: expression in static assertion is not an integer
245 | #define __BUILD_BUG_ON_ZERO_MSG(e, msg) ((int)sizeof(struct {_Static_assert(!(e), msg);}))
| ^
include/linux/compiler.h:249:33: note: in expansion of macro '__BUILD_BUG_ON_ZERO_MSG'
249 | #define __must_be_array(a) __BUILD_BUG_ON_ZERO_MSG(__same_type((a), &(a)[0]), "must be array")
| ^~~~~~~~~~~~~~~~~~~~~~~
include/linux/array_size.h:11:59: note: in expansion of macro '__must_be_array'
11 | #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) + __must_be_array(arr))
| ^~~~~~~~~~~~~~~
include/linux/moduleparam.h:521:20: note: in expansion of macro 'ARRAY_SIZE'
521 | = { .max = ARRAY_SIZE(array), .num = nump, \
| ^~~~~~~~~~
include/linux/moduleparam.h:505:9: note: in expansion of macro 'module_param_array_named'
505 | module_param_array_named(name, name, type, nump, perm)
| ^~~~~~~~~~~~~~~~~~~~~~~~
sound/pci/rme32.c:80:1: note: in expansion of macro 'module_param_array'
80 | module_param_array(index, int, NULL, 0444);
| ^~~~~~~~~~~~~~~~~~
sound/pci/rme32.c:75:12: warning: 'index' defined but not used [-Wunused-variable]
75 | static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */
| ^~~~~
--
In file included from include/linux/irqflags.h:19,
from include/linux/spinlock.h:59,
from include/linux/sched.h:2140,
from include/linux/delay.h:23,
from sound/pci/rme96.c:12:
arch/loongarch/include/asm/percpu.h:20:4: error: #error compiler support for the model attribute is necessary when a recent assembler is used
20 | # error compiler support for the model attribute is necessary when a recent assembler is used
| ^~~~~
In file included from include/asm-generic/div64.h:27,
from ./arch/loongarch/include/generated/asm/div64.h:1,
from include/linux/math.h:6,
from include/linux/delay.h:22:
>> include/linux/compiler.h:245:77: error: expression in static assertion is not an integer
245 | #define __BUILD_BUG_ON_ZERO_MSG(e, msg) ((int)sizeof(struct {_Static_assert(!(e), msg);}))
| ^
include/linux/compiler.h:249:33: note: in expansion of macro '__BUILD_BUG_ON_ZERO_MSG'
249 | #define __must_be_array(a) __BUILD_BUG_ON_ZERO_MSG(__same_type((a), &(a)[0]), "must be array")
| ^~~~~~~~~~~~~~~~~~~~~~~
include/linux/array_size.h:11:59: note: in expansion of macro '__must_be_array'
11 | #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) + __must_be_array(arr))
| ^~~~~~~~~~~~~~~
include/linux/moduleparam.h:521:20: note: in expansion of macro 'ARRAY_SIZE'
521 | = { .max = ARRAY_SIZE(array), .num = nump, \
| ^~~~~~~~~~
include/linux/moduleparam.h:505:9: note: in expansion of macro 'module_param_array_named'
505 | module_param_array_named(name, name, type, nump, perm)
| ^~~~~~~~~~~~~~~~~~~~~~~~
sound/pci/rme96.c:39:1: note: in expansion of macro 'module_param_array'
39 | module_param_array(index, int, NULL, 0444);
| ^~~~~~~~~~~~~~~~~~
sound/pci/rme96.c:35:12: warning: 'index' defined but not used [-Wunused-variable]
35 | static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */
| ^~~~~
--
In file included from include/linux/lockdep.h:15,
from include/linux/mutex.h:17,
from include/linux/kernfs.h:11,
from include/linux/sysfs.h:16,
from include/linux/kobject.h:20,
from include/linux/pci.h:35,
from sound/pci/au88x0/au88x0.h:8,
from sound/pci/au88x0/au8810.c:3:
arch/loongarch/include/asm/percpu.h:20:4: error: #error compiler support for the model attribute is necessary when a recent assembler is used
20 | # error compiler support for the model attribute is necessary when a recent assembler is used
| ^~~~~
In file included from include/linux/array_size.h:5,
from include/linux/string.h:6,
from include/linux/uuid.h:11,
from include/linux/mod_devicetable.h:14,
from include/linux/pci.h:27:
>> include/linux/compiler.h:245:77: error: expression in static assertion is not an integer
245 | #define __BUILD_BUG_ON_ZERO_MSG(e, msg) ((int)sizeof(struct {_Static_assert(!(e), msg);}))
| ^
include/linux/compiler.h:249:33: note: in expansion of macro '__BUILD_BUG_ON_ZERO_MSG'
249 | #define __must_be_array(a) __BUILD_BUG_ON_ZERO_MSG(__same_type((a), &(a)[0]), "must be array")
| ^~~~~~~~~~~~~~~~~~~~~~~
include/linux/array_size.h:11:59: note: in expansion of macro '__must_be_array'
11 | #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) + __must_be_array(arr))
| ^~~~~~~~~~~~~~~
include/linux/moduleparam.h:521:20: note: in expansion of macro 'ARRAY_SIZE'
521 | = { .max = ARRAY_SIZE(array), .num = nump, \
| ^~~~~~~~~~
include/linux/moduleparam.h:505:9: note: in expansion of macro 'module_param_array_named'
505 | module_param_array_named(name, name, type, nump, perm)
| ^~~~~~~~~~~~~~~~~~~~~~~~
sound/pci/au88x0/au88x0.c:33:1: note: in expansion of macro 'module_param_array'
33 | module_param_array(index, int, NULL, 0444);
| ^~~~~~~~~~~~~~~~~~
In file included from sound/pci/au88x0/au8810.c:17:
sound/pci/au88x0/au88x0.c:28:12: warning: 'index' defined but not used [-Wunused-variable]
28 | static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX;
| ^~~~~
--
In file included from include/linux/lockdep.h:15,
from include/linux/mutex.h:17,
from include/linux/kernfs.h:11,
from include/linux/sysfs.h:16,
from include/linux/kobject.h:20,
from include/linux/pci.h:35,
from sound/pci/aw2/aw2-alsa.c:11:
arch/loongarch/include/asm/percpu.h:20:4: error: #error compiler support for the model attribute is necessary when a recent assembler is used
20 | # error compiler support for the model attribute is necessary when a recent assembler is used
| ^~~~~
In file included from include/linux/build_bug.h:5,
from include/linux/init.h:5,
from sound/pci/aw2/aw2-alsa.c:10:
>> include/linux/compiler.h:245:77: error: expression in static assertion is not an integer
245 | #define __BUILD_BUG_ON_ZERO_MSG(e, msg) ((int)sizeof(struct {_Static_assert(!(e), msg);}))
| ^
include/linux/compiler.h:249:33: note: in expansion of macro '__BUILD_BUG_ON_ZERO_MSG'
249 | #define __must_be_array(a) __BUILD_BUG_ON_ZERO_MSG(__same_type((a), &(a)[0]), "must be array")
| ^~~~~~~~~~~~~~~~~~~~~~~
include/linux/array_size.h:11:59: note: in expansion of macro '__must_be_array'
11 | #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) + __must_be_array(arr))
| ^~~~~~~~~~~~~~~
include/linux/moduleparam.h:521:20: note: in expansion of macro 'ARRAY_SIZE'
521 | = { .max = ARRAY_SIZE(array), .num = nump, \
| ^~~~~~~~~~
include/linux/moduleparam.h:505:9: note: in expansion of macro 'module_param_array_named'
505 | module_param_array_named(name, name, type, nump, perm)
| ^~~~~~~~~~~~~~~~~~~~~~~~
sound/pci/aw2/aw2-alsa.c:137:1: note: in expansion of macro 'module_param_array'
137 | module_param_array(index, int, NULL, 0444);
| ^~~~~~~~~~~~~~~~~~
sound/pci/aw2/aw2-alsa.c:133:12: warning: 'index' defined but not used [-Wunused-variable]
133 | static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX;
| ^~~~~
--
In file included from include/linux/lockdep.h:15,
from include/linux/mutex.h:17,
from include/linux/kernfs.h:11,
from include/linux/sysfs.h:16,
from include/linux/kobject.h:20,
from include/linux/pci.h:35,
from sound/pci/cs46xx/cs46xx.c:13:
arch/loongarch/include/asm/percpu.h:20:4: error: #error compiler support for the model attribute is necessary when a recent assembler is used
20 | # error compiler support for the model attribute is necessary when a recent assembler is used
| ^~~~~
In file included from include/linux/array_size.h:5,
from include/linux/string.h:6,
from include/linux/uuid.h:11,
from include/linux/mod_devicetable.h:14,
from include/linux/pci.h:27:
>> include/linux/compiler.h:245:77: error: expression in static assertion is not an integer
245 | #define __BUILD_BUG_ON_ZERO_MSG(e, msg) ((int)sizeof(struct {_Static_assert(!(e), msg);}))
| ^
include/linux/compiler.h:249:33: note: in expansion of macro '__BUILD_BUG_ON_ZERO_MSG'
249 | #define __must_be_array(a) __BUILD_BUG_ON_ZERO_MSG(__same_type((a), &(a)[0]), "must be array")
| ^~~~~~~~~~~~~~~~~~~~~~~
include/linux/array_size.h:11:59: note: in expansion of macro '__must_be_array'
11 | #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) + __must_be_array(arr))
| ^~~~~~~~~~~~~~~
include/linux/moduleparam.h:521:20: note: in expansion of macro 'ARRAY_SIZE'
521 | = { .max = ARRAY_SIZE(array), .num = nump, \
| ^~~~~~~~~~
include/linux/moduleparam.h:505:9: note: in expansion of macro 'module_param_array_named'
505 | module_param_array_named(name, name, type, nump, perm)
| ^~~~~~~~~~~~~~~~~~~~~~~~
sound/pci/cs46xx/cs46xx.c:32:1: note: in expansion of macro 'module_param_array'
32 | module_param_array(index, int, NULL, 0444);
| ^~~~~~~~~~~~~~~~~~
sound/pci/cs46xx/cs46xx.c:25:12: warning: 'index' defined but not used [-Wunused-variable]
25 | static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */
| ^~~~~
..


vim +245 include/linux/compiler.h

241
242 #ifdef __CHECKER__
243 #define __BUILD_BUG_ON_ZERO_MSG(e, msg) (0)
244 #else /* __CHECKER__ */
> 245 #define __BUILD_BUG_ON_ZERO_MSG(e, msg) ((int)sizeof(struct {_Static_assert(!(e), msg);}))
246 #endif /* __CHECKER__ */
247

--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki