From mboxrd@z Thu Jan 1 00:00:00 1970 From: Olivier MATZ Subject: Re: [PATCH] test-pmd: Fix pointer aliasing error Date: Wed, 03 Dec 2014 16:24:39 +0100 Message-ID: <547F2B37.5060500@6wind.com> References: <1417606044-3432-1-git-send-email-michael.qiu@intel.com> <1417606099-3489-1-git-send-email-michael.qiu@intel.com> <20141203114258.GA2396@bricha3-MOBL3> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: quoted-printable Cc: dev-VfR2kkLFssw@public.gmane.org To: Bruce Richardson , Michael Qiu Return-path: In-Reply-To: <20141203114258.GA2396@bricha3-MOBL3> 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" Hi Bruce, On 12/03/2014 12:42 PM, Bruce Richardson wrote: > 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 >> ... >> >> 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= may > affect performance as it reduces the number of optimizations that the c= ompiler > can perform. I can reproduce the issue with a gcc-4.4.6 toolchain. But I think it's a toolchain bug as the warning does not occur with other versions I've tested. If it's the case, we could either: - do nothing: in this case the user need to upgrade its toolchain, or pass the -Wno-strict-aliasing manually in EXTRA_CFLAGS - add the -Wno-strict-aliasing only for gcc 4.4 in the Makefile What do you think? Regards, Olivier