From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by dpdk.org (Postfix) with ESMTP id A8FE0567E for ; Wed, 9 Dec 2015 10:13:40 +0100 (CET) Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga101.fm.intel.com with ESMTP; 09 Dec 2015 01:13:40 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.20,402,1444719600"; d="scan'208";a="867825390" Received: from fmsmsx105.amr.corp.intel.com ([10.18.124.203]) by orsmga002.jf.intel.com with ESMTP; 09 Dec 2015 01:13:39 -0800 Received: from fmsmsx154.amr.corp.intel.com (10.18.116.70) by FMSMSX105.amr.corp.intel.com (10.18.124.203) with Microsoft SMTP Server (TLS) id 14.3.248.2; Wed, 9 Dec 2015 01:13:39 -0800 Received: from shsmsx151.ccr.corp.intel.com (10.239.6.50) by FMSMSX154.amr.corp.intel.com (10.18.116.70) with Microsoft SMTP Server (TLS) id 14.3.248.2; Wed, 9 Dec 2015 01:13:38 -0800 Received: from shsmsx103.ccr.corp.intel.com ([169.254.4.138]) by SHSMSX151.ccr.corp.intel.com ([169.254.3.92]) with mapi id 14.03.0248.002; Wed, 9 Dec 2015 17:12:54 +0800 From: "Xie, Huawei" To: "De Lara Guarch, Pablo" , "dev@dpdk.org" Thread-Topic: [PATCH] examples/vhost: fix strict aliasing error on gcc 4.4.7 Thread-Index: AdEyYciNtijl03mZQQa3m/1CtBzJHQ== Date: Wed, 9 Dec 2015 09:12:53 +0000 Message-ID: References: <1449573835-149947-1-git-send-email-pablo.de.lara.guarch@intel.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] Content-Type: text/plain; charset="Windows-1252" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dpdk-dev] [PATCH] examples/vhost: fix strict aliasing error on gcc 4.4.7 X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 09 Dec 2015 09:13:41 -0000 On 12/8/2015 7:24 PM, De Lara Guarch, Pablo wrote:=0A= > Fixes following error on gcc 4.4.7:=0A= >=0A= > make: Entering directory `/tmp/dpdk-tmp/examples/vhost'=0A= > CC main.o=0A= > cc1: warnings being treated as errors=0A= > /tmp/dpdk-tmp/examples/vhost/main.c: In function =91new_device=92:=0A= > /tmp/dpdk-tmp/x86_64-native-linuxapp-gcc/include/rte_ring.h:740: error:= =0A= > dereferencing pointer =91mbuf.486=92 does break strict-aliasing rules= =0A= > /tmp/dpdk-tmp/examples/vhost/main.c:1503: note: initialized from here=0A= > ...=0A= > /tmp/dpdk-tmp/examples/vhost/main.c:1503: note: initialized from here=0A= > /tmp/dpdk-tmp/x86_64-native-linuxapp-gcc/include/rte_ring.h:740: error:= =0A= > dereferencing pointer =91({anonymous})=92 does break strict-aliasing = rules=0A= > /tmp/dpdk-tmp/examples/vhost/main.c:1804: note: initialized from here=0A= > make[1]: *** [main.o] Error 1=0A= >=0A= > Fixes: d19533e8 ("examples/vhost: copy old vhost example")=0A= >=0A= > Reported-by: Qian Xu =0A= > Signed-off-by: Pablo de Lara =0A= > ---=0A= > examples/vhost/main.c | 14 +++++++++-----=0A= > 1 file changed, 9 insertions(+), 5 deletions(-)=0A= >=0A= [...]=0A= > =0A= > - rte_ring_sc_dequeue(vpool->ring, (void **)&mbuf);=0A= > + rte_ring_sc_dequeue(vpool->ring, (void **)&obj);=0A= > + mbuf =3D (struct rte_mbuf *)obj;=0A= Is rte_ring_sc_dequeue(vpool->ring, &obj) enough? Applied to the later=0A= enqueue as well.=0A= > if (unlikely(mbuf =3D=3D NULL)) {=0A= [...]=0A= > - rte_ring_sp_enqueue(vpool->ring, (void *)mbuf);=0A= > + rte_ring_sp_enqueue(vpool->ring, obj);=0A= > return;=0A= > }=0A= > =0A= > @@ -1789,7 +1791,8 @@ virtio_tx_route_zcp(struct virtio_net *dev, struct = rte_mbuf *m,=0A= > {=0A= > =0A= [...]=0A= > vpool =3D &vpool_array[MAX_QUEUES + vmdq_rx_q];=0A= > - rte_ring_sc_dequeue(vpool->ring, (void **)&mbuf);=0A= > + rte_ring_sc_dequeue(vpool->ring, (void **)&obj);=0A= > + mbuf =3D (struct rte_mbuf *) obj;=0A= > if (unlikely(mbuf =3D=3D NULL)) {=0A= > struct vhost_virtqueue *vq =3D dev->virtqueue[VIRTIO_TXQ];=0A= > RTE_LOG(ERR, VHOST_DATA,=0A= =0A=