From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pa0-f42.google.com (mail-pa0-f42.google.com [209.85.220.42]) by dpdk.org (Postfix) with ESMTP id 5C0F868BE for ; Thu, 11 Dec 2014 18:51:46 +0100 (CET) Received: by mail-pa0-f42.google.com with SMTP id et14so5476343pad.15 for ; Thu, 11 Dec 2014 09:51:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=rpNPaf9BdPqjLx0F/3HhBQOzY4itb+Ao5PGYa3RrJ20=; b=ICaYRKtBClcK4rbXdqjWM6fpZcw+BcObMOsZalQC3RzV3766EfjnwfmE8Y8r52+UwJ 3BcW1+Q4mKIFo6E5prgz6umyMFIueVUF/DEuBhVr60VjioROfE2okwCNna86VgKXegvH YZfG7rauUZPbg1cJVxGRMy2ScgY1Cyzm2mtjJN/j32SJBUK8ohN+aeDgKdJAsW9w0X2z auj9P0+LPCranGjLV285e7n1846d0woK9BHv8EJKoVddnr+ChszeMJp3rg2aRkv/EhNd dQ1EDHloyta1KCcFypo3Z24ymelkSBwMqZfdbkUR0NUFR0KmbDYPBKledC7h/uOXAoGA K8sg== MIME-Version: 1.0 X-Received: by 10.70.44.197 with SMTP id g5mr18966023pdm.102.1418320304672; Thu, 11 Dec 2014 09:51:44 -0800 (PST) Received: by 10.70.70.40 with HTTP; Thu, 11 Dec 2014 09:51:44 -0800 (PST) In-Reply-To: <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> <1930269.B5nWyJ5DBl@xps13> Date: Thu, 11 Dec 2014 09:51:44 -0800 Message-ID: From: r k To: Thomas Monjalon Content-Type: text/plain; charset=ISO-8859-1 X-Content-Filtered-By: Mailman/MimeDel 2.1.15 Cc: "dev@dpdk.org" Subject: Re: [dpdk-dev] [PATCH v3] test-pmd: Fix pointer aliasing error 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: Thu, 11 Dec 2014 17:51:46 -0000 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 >