On 12/8/2015 7:24 PM, De Lara Guarch, Pablo wrote:
> Fixes following error on gcc 4.4.7:
>
> make: Entering directory `/tmp/dpdk-tmp/examples/vhost'
> CC main.o
> cc1: warnings being treated as errors
> /tmp/dpdk-tmp/examples/vhost/main.c: In function ?new_device?:
> /tmp/dpdk-tmp/x86_64-native-linuxapp-gcc/include/rte_ring.h:740: error:
> dereferencing pointer ?mbuf.486? does break strict-aliasing rules
> /tmp/dpdk-tmp/examples/vhost/main.c:1503: note: initialized from here
> ...
> /tmp/dpdk-tmp/examples/vhost/main.c:1503: note: initialized from here
> /tmp/dpdk-tmp/x86_64-native-linuxapp-gcc/include/rte_ring.h:740: error:
> dereferencing pointer ?({anonymous})? does break strict-aliasing rules
> /tmp/dpdk-tmp/examples/vhost/main.c:1804: note: initialized from here
> make[1]: *** [main.o] Error 1
>
> Fixes: d19533e8 ("examples/vhost: copy old vhost example")
>
> Reported-by: Qian Xu <qian.q.xu at intel.com>
> Signed-off-by: Pablo de Lara <pablo.de.lara.guarch at intel.com>
> ---
> examples/vhost/main.c | 14 +++++++++-----
> 1 file changed, 9 insertions(+), 5 deletions(-)
>
[...]
>
> - rte_ring_sc_dequeue(vpool->ring, (void **)&mbuf);
> + rte_ring_sc_dequeue(vpool->ring, (void **)&obj);
> + mbuf = (struct rte_mbuf *)obj;
Is rte_ring_sc_dequeue(vpool->ring, &obj) enough? Applied to the later
enqueue as well.
> if (unlikely(mbuf == NULL)) {
[...]
> - rte_ring_sp_enqueue(vpool->ring, (void *)mbuf);
> + rte_ring_sp_enqueue(vpool->ring, obj);
> return;
> }
>
> @@ -1789,7 +1791,8 @@ virtio_tx_route_zcp(struct virtio_net *dev, struct
> rte_mbuf *m,
> {
>
[...]
> vpool = &vpool_array[MAX_QUEUES + vmdq_rx_q];
> - rte_ring_sc_dequeue(vpool->ring, (void **)&mbuf);
> + rte_ring_sc_dequeue(vpool->ring, (void **)&obj);
> + mbuf = (struct rte_mbuf *) obj;
> if (unlikely(mbuf == NULL)) {
> struct vhost_virtqueue *vq = dev->virtqueue[VIRTIO_TXQ];
> RTE_LOG(ERR, VHOST_DATA,