On 30/09/2024 15:49, David Binderman wrote: > Hello there, > > I just tried to build linux-6.12-rc1 with clang. It said: > > drivers/iio/imu/bmi323/bmi323_core.c:133:27: warning: variable 'bmi323_ext_reg_savestate' is not needed and will not be emitted [-Wunneeded-internal-declaration] > > A grep for the identifier shows the following strange results:: > > inux-6.12-rc1 $ grep bmi323_ext_reg_savestate drivers/iio/imu/bmi323/bmi323_core.c > static const unsigned int bmi323_ext_reg_savestate[] = { > unsigned int ext_reg_settings[ARRAY_SIZE(bmi323_ext_reg_savestate)]; > for (unsigned int i = 0; i < ARRAY_SIZE(bmi323_ext_reg_savestate); i++) { > for (unsigned int i = 0; i < ARRAY_SIZE(bmi323_ext_reg_savestate); i++) { > linux-6.12-rc1 $ > > I see no mention of bmi323_ext_reg_savestate[ i]. Is there a possible > cut'n'paste error in one of the two for loops ? > > Regards > > David Binderman I think that is a bug in clang: https://bugs.llvm.org/show_bug.cgi?id=33068 That happens because clang sees that bmi323_ext_reg_savestate is not used but to gets its size, and that means for it that the variable is not needed. That does not happen for example with bmi323_ext_reg_savestate (right above bmi323_ext_reg_savestate) because that one is used beyond ARRAY_SIZE. Safe to ignore? Best regards, Javier Carrasco