[dpdk-dev] [PATCH] net/virtio: fix gcc6 i686 compiler error

Yuanhan Liu yuanhan.liu at linux.intel.com
Mon Jul 11 04:56:20 CEST 2016


On Thu, Jul 07, 2016 at 02:49:08PM +0100, Ferruh Yigit wrote:
> This is for target i686-native-linuxapp-gcc and gcc6,
> 
> Compilation error is:
> == Build drivers/net/virtio
>   CC virtio_rxtx_simple.o
> In file included from
> .../build/include/rte_mempool.h:77:0,
>                  from
> .../drivers/net/virtio/virtio_rxtx_simple.c:46:
> .../drivers/net/virtio/virtio_rxtx_simple.c: In
> function ‘virtio_xmit_pkts_simple’:
> .../build/include/rte_memcpy.h:551:2: error: array
> subscript is above array bounds [-Werror=array-bounds]
>   rte_mov16((uint8_t *)dst + 1 * 16, (const uint8_t *)src + 1 * 16);
>   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> 
...
> 
> The compiler traces the array all through the call stack and knows the
> size of array is 128 and generates a warning on above [1] which tries to
> access beyond byte 128.
> But unfortunately it ignores the "(size > 256)" check.
> 
> Giving a hint to compiler that variable "size" is related to the size of
> the source buffer fixes compiler warning.
> 
> Fixes: 863bfb474493 ("mempool: optimize copy in cache")
> 
> Signed-off-by: Ferruh Yigit <ferruh.yigit at intel.com>

Applied to dpdk-next-virtio.

Thanks.

	--yliu


More information about the dev mailing list