From patchwork Tue Nov 24 15:12:39 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Mrzyglod X-Patchwork-Id: 9089 Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [IPv6:::1]) by dpdk.org (Postfix) with ESMTP id 16DA58E8B; Tue, 24 Nov 2015 16:13:18 +0100 (CET) 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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" 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 Acked-by: Konstantin Ananyev --- 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];