From mboxrd@z Thu Jan 1 00:00:00 1970 From: Bruce Richardson Subject: Re: [PATCH] test-pmd: Fix pointer aliasing error Date: Wed, 3 Dec 2014 11:42:58 +0000 Message-ID: <20141203114258.GA2396@bricha3-MOBL3> References: <1417606044-3432-1-git-send-email-michael.qiu@intel.com> <1417606099-3489-1-git-send-email-michael.qiu@intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Cc: dev-VfR2kkLFssw@public.gmane.org To: Michael Qiu Return-path: Content-Disposition: inline In-Reply-To: <1417606099-3489-1-git-send-email-michael.qiu-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org> List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces-VfR2kkLFssw@public.gmane.org Sender: "dev" On Wed, Dec 03, 2014 at 07:28:19PM +0800, Michael Qiu wrote: > app/test-pmd/csumonly.c: In function =E2=80=98get_psd_sum=E2=80=99: > build/include/rte_ip.h:161: error: dereferencing pointer =E2=80=98u16=E2= =80=99 > does break strict-aliasing rules > build/include/rte_ip.h:157: note: initialized from here > ... >=20 > The root cause is that, compile enable strict aliasing by default, > while in function rte_raw_cksum() try to convert 'const char *' > to 'const uint16_t *'. > What compiler version is this with? Is there any other way to fix this other than disabling the compiler warnings. Turning off strict aliasing m= ay affect performance as it reduces the number of optimizations that the com= piler can perform. /Bruce > Need to add CFLAG '-Wno-strict-aliasing' to avoid this issue. >=20 > Signed-off-by: Michael Qiu > --- > app/test-pmd/Makefile | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) >=20 > diff --git a/app/test-pmd/Makefile b/app/test-pmd/Makefile > index 97dc2e6..995c874 100644 > --- a/app/test-pmd/Makefile > +++ b/app/test-pmd/Makefile > @@ -38,7 +38,7 @@ ifeq ($(CONFIG_RTE_TEST_PMD),y) > # > APP =3D testpmd > =20 > -CFLAGS +=3D -O3 > +CFLAGS +=3D -O3 -Wno-strict-aliasing > CFLAGS +=3D $(WERROR_FLAGS) > =20 > ifeq ($(CONFIG_RTE_LIBRTE_PMD_PCAP),y) > --=20 > 1.9.3 >=20