From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by dpdk.org (Postfix) with ESMTP id E31D18E8B for ; Tue, 24 Nov 2015 17:33:16 +0100 (CET) Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga102.jf.intel.com with ESMTP; 24 Nov 2015 08:33:09 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.20,338,1444719600"; d="scan'208";a="858501591" Received: from unknown ([10.217.248.15]) by orsmga002.jf.intel.com with SMTP; 24 Nov 2015 08:33:07 -0800 Received: by (sSMTP sendmail emulation); Tue, 24 Nov 2015 17:33:06 +0100 From: Daniel Mrzyglod To: dev@dpdk.org Date: Tue, 24 Nov 2015 17:31:18 +0100 Message-Id: <1448382678-6060-2-git-send-email-danielx.t.mrzyglod@intel.com> X-Mailer: git-send-email 2.5.3 In-Reply-To: <1448382678-6060-1-git-send-email-danielx.t.mrzyglod@intel.com> References: <1448377959-4440-1-git-send-email-danielx.t.mrzyglod@intel.com> <1448382678-6060-1-git-send-email-danielx.t.mrzyglod@intel.com> Subject: [dpdk-dev] [PATCH v2] 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 16:33:17 -0000 This fix is for IPv6 checksum offload error on RHEL65. Any optimalisation above -O0 provide error in IPv6 checksum 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