From mboxrd@z Thu Jan 1 00:00:00 1970 From: Thomas Monjalon Subject: Re: [PATCH v3] test-pmd: Fix pointer aliasing error Date: Thu, 11 Dec 2014 01:54:21 +0100 Message-ID: <1930269.B5nWyJ5DBl@xps13> References: <1417663711-19576-1-git-send-email-michael.qiu@intel.com> <1417666564-19950-1-git-send-email-michael.qiu@intel.com> <533710CFB86FA344BFBF2D6802E60286C9D683@SHSMSX101.ccr.corp.intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable To: "Qiu, Michael" , dev-VfR2kkLFssw@public.gmane.org Return-path: In-Reply-To: <533710CFB86FA344BFBF2D6802E60286C9D683-0J0gbvR4kThpB2pF5aRoyrfspsVTdybXVpNB7YpNyf8@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" > > 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=98u= 16=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 *'. > > > > This patch is one workaround fix. > > > > Signed-off-by: Michael Qiu > > --- > > v3 --> v2: > > =09use uintptr_t instead of unsigned long to > > =09save pointer. > > > > v2 --> v1: > > =09Workaround solution instead of shut off the > > =09gcc params. >=20 > This workaround is to solve the compile issue of GCC strict-aliasing(= Two > different type pointers should not be point to the same memory addres= s). >=20 > For GCC 4.4.7 it will definitely occurs if flags "-fstrict-aliasing"= > and "-Wall" used. Acked-by: Thomas Monjalon >=20 Applied with a comment in the code. Thanks --=20 Thomas