public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [norov:bitmap-for-next 43/43] lib/bitmap.c:1571:36: warning: operation on 'i' may be undefined
@ 2022-04-10 21:21 kernel test robot
  0 siblings, 0 replies; only message in thread
From: kernel test robot @ 2022-04-10 21:21 UTC (permalink / raw)
  To: Yury Norov; +Cc: kbuild-all, linux-kernel

tree:   https://github.com/norov/linux bitmap-for-next
head:   a136dfabd10d0c1354c41a069cc4e00147a721e1
commit: a136dfabd10d0c1354c41a069cc4e00147a721e1 [43/43] bitmap_from_arr64
config: um-i386_defconfig (https://download.01.org/0day-ci/archive/20220411/202204110512.jCY23V15-lkp@intel.com/config)
compiler: gcc-11 (Debian 11.2.0-19) 11.2.0
reproduce (this is a W=1 build):
        # https://github.com/norov/linux/commit/a136dfabd10d0c1354c41a069cc4e00147a721e1
        git remote add norov https://github.com/norov/linux
        git fetch --no-tags norov bitmap-for-next
        git checkout a136dfabd10d0c1354c41a069cc4e00147a721e1
        # save the config file to linux build tree
        mkdir build_dir
        make W=1 O=build_dir ARCH=um SUBARCH=i386 SHELL=/bin/bash

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

All warnings (new ones prefixed by >>):

   lib/bitmap.c: In function 'bitmap_to_arr64':
>> lib/bitmap.c:1571:36: warning: operation on 'i' may be undefined [-Wsequence-point]
    1571 |                 buf[i/2] = bitmap[i++];
         |                                   ~^~
>> lib/bitmap.c:1573:49: warning: left shift count >= width of type [-Wshift-count-overflow]
    1573 |                         buf[i/2] |= bitmap[i++] << 32;
         |                                                 ^~
   lib/bitmap.c:1573:45: warning: operation on 'i' may be undefined [-Wsequence-point]
    1573 |                         buf[i/2] |= bitmap[i++] << 32;
         |                                            ~^~
   lib/bitmap.c:1573:45: warning: operation on 'i' may be undefined [-Wsequence-point]


vim +/i +1571 lib/bitmap.c

  1559	
  1560	/**
  1561	 * bitmap_to_arr64 - copy the contents of bitmap to a u64 array of bits
  1562	 *	@buf: array of u64 (in host byte order), the dest bitmap
  1563	 *	@bitmap: array of unsigned longs, the source bitmap
  1564	 *	@nbits: number of bits in @bitmap
  1565	 */
  1566	void bitmap_to_arr64(u64 *buf, const unsigned long *bitmap, unsigned int nbits)
  1567	{
  1568		unsigned int i = 0, words = BITS_TO_LONGS(nbits);
  1569	
  1570		while (i < words) {
> 1571			buf[i/2] = bitmap[i++];
  1572			if (i < words)
> 1573				buf[i/2] |= bitmap[i++] << 32;
  1574		}
  1575	
  1576		/* Clear tail bits in last element of array beyond nbits. */
  1577		if (nbits % 64)
  1578			buf[i - 1] &= GENMASK_ULL(nbits, 0);
  1579	}
  1580	EXPORT_SYMBOL(bitmap_to_arr64);
  1581	

-- 
0-DAY CI Kernel Test Service
https://01.org/lkp

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-04-10 21:21 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-04-10 21:21 [norov:bitmap-for-next 43/43] lib/bitmap.c:1571:36: warning: operation on 'i' may be undefined kernel test robot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox