From mboxrd@z Thu Jan 1 00:00:00 1970 From: r k Subject: Re: [PATCH v3] test-pmd: Fix pointer aliasing error Date: Thu, 11 Dec 2014 09:51:44 -0800 Message-ID: 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> <1930269.B5nWyJ5DBl@xps13> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Cc: "dev-VfR2kkLFssw@public.gmane.org" To: Thomas Monjalon Return-path: In-Reply-To: <1930269.B5nWyJ5DBl@xps13> 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" Thomas, Michael, Wouldn't it cause unaligned memory access (new changes as well as the previous code)? Wondering if get_unaligned/put_unaligned macros similar to the ones used in kernel be ported to user-space? Thanks, Ravi On Wed, Dec 10, 2014 at 4:54 PM, Thomas Monjalon wrote: > > > > app/test-pmd/csumonly.c: In function 'get_psd_sum': > > > build/include/rte_ip.h:161: error: dereferencing pointer 'u16' > > > 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: > > > use uintptr_t instead of unsigned long to > > > save pointer. > > > > > > v2 --> v1: > > > Workaround solution instead of shut off the > > > gcc params. > > > > This workaround is to solve the compile issue of GCC strict-aliasing(Two > > different type pointers should not be point to the same memory address). > > > > For GCC 4.4.7 it will definitely occurs if flags "-fstrict-aliasing" > > and "-Wall" used. > > Acked-by: Thomas Monjalon > > > Applied with a comment in the code. > > Thanks > -- > Thomas >