From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wi0-f179.google.com (mail-wi0-f179.google.com [209.85.212.179]) by dpdk.org (Postfix) with ESMTP id 03DA58057 for ; Wed, 3 Dec 2014 16:24:41 +0100 (CET) Received: by mail-wi0-f179.google.com with SMTP id ex7so24830982wid.12 for ; Wed, 03 Dec 2014 07:24:40 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:message-id:date:from:user-agent:mime-version:to :cc:subject:references:in-reply-to:content-type :content-transfer-encoding; bh=IqPe4Xk0JtXB3y2GqsPiHwkKOKhW2gX5HDRiYHYfE/Q=; b=BqXKkccvPJuZFPxg/H1WEwqvui3LZ9eaEj2S3fQEESsAqLSmCgWAMhEDMmH2i5Wr2l 8MJ//U60PUFo8ornGpbPggaEhxLTq/yGBXixQtYzT+iKgOCfi1L197VYZ/lFUU09CGzy aDW4u5CsxkGb0Z0ZBgXJO2R8bCqyU3yS7uT5OjaPoByW6nD7Ktoc7ckm8EA71RznlCiv qtsk7L5UltGSadv1qARU0ryTUN1/2U24dCa0YbEtprEuRwgS1HxCYM7DnefcDtUyqIew xp2HytFXxQAPMl9VyTPOGDUE7468Y54iXAu8Iu2fyNI0dDqNmluOS8kl91XN+iFrWQNs VyDQ== X-Gm-Message-State: ALoCoQm4HG9d1ltS3V+dJ/E8LLe4hWH9t8YM8Oey9G50N6vDm9bCq36TXA+8RnqPtIrVS3rLk7u3 X-Received: by 10.180.76.144 with SMTP id k16mr13998193wiw.3.1417620280849; Wed, 03 Dec 2014 07:24:40 -0800 (PST) Received: from [10.16.0.195] (guy78-3-82-239-227-177.fbx.proxad.net. [82.239.227.177]) by mx.google.com with ESMTPSA id h2sm37540409wix.5.2014.12.03.07.24.40 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 03 Dec 2014 07:24:40 -0800 (PST) Message-ID: <547F2B37.5060500@6wind.com> Date: Wed, 03 Dec 2014 16:24:39 +0100 From: Olivier MATZ User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Icedove/24.5.0 MIME-Version: 1.0 To: Bruce Richardson , Michael Qiu 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> In-Reply-To: <20141203114258.GA2396@bricha3-MOBL3> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit 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 15:24:41 -0000 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 ‘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. 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