From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by dpdk.org (Postfix) with ESMTP id 465428E85 for ; Tue, 24 Nov 2015 16:13:16 +0100 (CET) Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga101.fm.intel.com with ESMTP; 24 Nov 2015 07:13:14 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.20,338,1444719600"; d="scan'208";a="858444325" Received: from unknown ([10.217.248.15]) by orsmga002.jf.intel.com with SMTP; 24 Nov 2015 07:13:11 -0800 Received: by (sSMTP sendmail emulation); Tue, 24 Nov 2015 16:12:48 +0100 From: Daniel Mrzyglod To: dev@dpdk.org Date: Tue, 24 Nov 2015 16:12:39 +0100 Message-Id: <1448377959-4440-1-git-send-email-danielx.t.mrzyglod@intel.com> X-Mailer: git-send-email 2.5.3 Subject: [dpdk-dev] [PATCH] net: fix build with gcc 4.4.7 and strict aliasing 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: Tue, 24 Nov 2015 15:13:16 -0000 This is fix for GCC 4.4.7. flag "-fstrict-aliasing" is default for optimalisation above -O0. Fixes: 2b039d5f20a3 ("net: fix build with gcc 4.4.7 and strict aliasing") Signed-off-by: Daniel Mrzyglod --- lib/librte_net/rte_ip.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/librte_net/rte_ip.h b/lib/librte_net/rte_ip.h index 71c519a..5b7554a 100644 --- a/lib/librte_net/rte_ip.h +++ b/lib/librte_net/rte_ip.h @@ -169,7 +169,8 @@ __rte_raw_cksum(const void *buf, size_t len, uint32_t sum) { /* workaround gcc strict-aliasing warning */ uintptr_t ptr = (uintptr_t)buf; - const uint16_t *u16 = (const uint16_t *)ptr; + typedef uint16_t __attribute__((__may_alias__)) u16_p; + const u16_p *u16 = (const u16_p *)ptr; while (len >= (sizeof(*u16) * 4)) { sum += u16[0]; -- 2.5.0