From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <bruce.richardson@intel.com>
Received: from mga09.intel.com (mga09.intel.com [134.134.136.24])
 by dpdk.org (Postfix) with ESMTP id 91B9068CD
 for <dev@dpdk.org>; Wed,  3 Dec 2014 12:43:03 +0100 (CET)
Received: from orsmga001.jf.intel.com ([10.7.209.18])
 by orsmga102.jf.intel.com with ESMTP; 03 Dec 2014 03:40:19 -0800
X-ExtLoop1: 1
X-IronPort-AV: E=Sophos;i="5.07,507,1413270000"; d="scan'208";a="617870645"
Received: from bricha3-mobl3.ger.corp.intel.com ([10.243.20.33])
 by orsmga001.jf.intel.com with SMTP; 03 Dec 2014 03:42:59 -0800
Received: by  (sSMTP sendmail emulation); Wed, 03 Dec 2014 11:42:58 +0025
Date: Wed, 3 Dec 2014 11:42:58 +0000
From: Bruce Richardson <bruce.richardson@intel.com>
To: Michael Qiu <qdy220091330@gmail.com>
Message-ID: <20141203114258.GA2396@bricha3-MOBL3>
References: <1417606044-3432-1-git-send-email-michael.qiu@intel.com>
 <1417606099-3489-1-git-send-email-michael.qiu@intel.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Disposition: inline
Content-Transfer-Encoding: 8bit
In-Reply-To: <1417606099-3489-1-git-send-email-michael.qiu@intel.com>
Organization: Intel Shannon Ltd.
User-Agent: Mutt/1.5.23 (2014-03-12)
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 <dev.dpdk.org>
List-Unsubscribe: <http://dpdk.org/ml/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://dpdk.org/ml/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <http://dpdk.org/ml/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
X-List-Received-Date: Wed, 03 Dec 2014 11:43:04 -0000

On Wed, Dec 03, 2014 at 07:28:19PM +0800, Michael Qiu 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 *'.
>

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.

/Bruce

> Need to add CFLAG '-Wno-strict-aliasing' to avoid this issue.
> 
> Signed-off-by: Michael Qiu <michael.qiu@intel.com>
> ---
>  app/test-pmd/Makefile | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/app/test-pmd/Makefile b/app/test-pmd/Makefile
> index 97dc2e6..995c874 100644
> --- a/app/test-pmd/Makefile
> +++ b/app/test-pmd/Makefile
> @@ -38,7 +38,7 @@ ifeq ($(CONFIG_RTE_TEST_PMD),y)
>  #
>  APP = testpmd
>  
> -CFLAGS += -O3
> +CFLAGS += -O3 -Wno-strict-aliasing
>  CFLAGS += $(WERROR_FLAGS)
>  
>  ifeq ($(CONFIG_RTE_LIBRTE_PMD_PCAP),y)
> -- 
> 1.9.3
>