From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-qg0-f45.google.com (mail-qg0-f45.google.com [209.85.192.45]) by dpdk.org (Postfix) with ESMTP id DA0B9804C for ; Wed, 3 Dec 2014 17:03:42 +0100 (CET) Received: by mail-qg0-f45.google.com with SMTP id f51so11148249qge.32 for ; Wed, 03 Dec 2014 08:03:42 -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=Rh1ciXqtkymK/1Zj+pOsSiG5Lmn5OWw6fzeacfcWM4k=; b=VqgX3XEIpr+g7XAfar//lxRe2jLkDmaCg7rXCudM6/bEU2N7vjrwlRscub4Kxb4jy8 mhLJ/z2WG2cB2+GuQ1pkeP5j6i9FVavwMq4pShmnfyK6vtB16RQT88+jhInV1uotDF0g b8ZmQjUN/Op5+PUDZ5lxn86pOt4eSSYq8y85Pk4oSqHZ4ImMjG0wEl6SoOd01DyzTZRe 71CiGU8IZaO5vYFgVKmtxW2WTbzekg7GIwACitijNHKExe2cZ+fPu0yzjWA3AFnTYiVy z1GEpn0OJpNXJ+NQ5V87aHyLxgaXfv18PrtSqiSF/1k+FShveq2/SPOO2j5rydW+pB4g JuOA== MIME-Version: 1.0 X-Received: by 10.224.11.10 with SMTP id r10mr9199843qar.42.1417622622333; Wed, 03 Dec 2014 08:03:42 -0800 (PST) Received: by 10.140.93.200 with HTTP; Wed, 3 Dec 2014 08:03:42 -0800 (PST) In-Reply-To: <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> <547F2B37.5060500@6wind.com> Date: Thu, 4 Dec 2014 00:03:42 +0800 Message-ID: From: Dayu Qiu To: Olivier MATZ Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.15 Cc: "dev@dpdk.org" Subject: Re: [dpdk-dev] [PATCH] 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: Wed, 03 Dec 2014 16:03:43 -0000 Hi Olivier, You can check gcc manual. -fstrict-aliasing Allow the compiler to assume the strictest aliasing rules applicable to the language being compiled. For C (and C++), this activates optimizations based on the type of expressions. In particular, an object of one type is assumed never to reside at the same address as an object of a different type, unless the types are almost the same. For example, an "unsigned int" can alias an "int", but not a "void*" or a "double". A character type may alias any other type. So it should not be a bug, but I have no idea about why other version does not reproduce. Thanks, Michael On Wed, Dec 3, 2014 at 11:24 PM, Olivier MATZ wrote: > 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 >> compiler >> 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 > > --=20 Thanks & Best Regards Mike