From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-qt0-f181.google.com (mail-qt0-f181.google.com [209.85.216.181]) by dpdk.org (Postfix) with ESMTP id CD51CDE5 for ; Wed, 25 Jan 2017 21:52:04 +0100 (CET) Received: by mail-qt0-f181.google.com with SMTP id x49so38403992qtc.2 for ; Wed, 25 Jan 2017 12:52:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=IqzAmZCGZ5ccXFEnDz/e1uvQui3ucRVh/k+qD0JV3Ps=; b=lIIA6tYaKrl4nswzkndosi9lDJWl1Rcn9xIOntUWl7Mog6joeaLc8LFNuKFVTwWLb7 O1Va7VHFg0jZhDNIvgK51KyrR5tWIrrGWJGLLWgRy9Rgw7Fi9zNfxm9kp2SVCqnigNET IKIpQ5U8PtD6DLONLs4wjmO4j+9mljZ6T9uOfcldTbtZ8vvG0kvy/bWYJPllmRwwgtWo jlsWzzcuwzTsteug6VETgYY73WAbtias56tJLQLVyoELCV1R3sW5PY9teWT2xFSWB0/g L6qAH3HGE/AIOTW6cqSyn5pBHMm+/EWUQpb1HAS1i5pS2BqS3oR+jFFBki/rT+HStR5K sLRA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=IqzAmZCGZ5ccXFEnDz/e1uvQui3ucRVh/k+qD0JV3Ps=; b=ooRYL1SmTeLgz8qYLRW2nYARsSWAP8ZhIdel0QqraPQjW9QWZPHqnFxqJXFFtAtriq AqzA6mN2ntfX1kbIV3hPrOmwgrh18V5w1Iotn2+C3ivZl0d7Jz86CN1zI0BgBati92Y/ IzpSfFVELlSQUkOoH7apDzbg5xUniU5fLUt1YZPWmE138w+ORcWTCveSyo9LAGVhU591 MM4tgRFs/73TElQmuhzn1/jP9EHzcN+XCcDheTjntJEI9qm63NnJ+XoasCqF1PObEVrv sMrRbNTdpdMZDhpllxiQepMLypWl9o/kxFTG7eJdPvLV/QJeAOo+m8chklL0hWQFvSYh rU7A== X-Gm-Message-State: AIkVDXLWyfam2Fjdk2BqCOvxEIBq7ZfLeenXsgkvv75sJDJbiriaJPx9DTMq4mYiTm5iiKH7HxI+OJIsKGwD2A== X-Received: by 10.200.44.185 with SMTP id 54mr34826694qtw.224.1485377523943; Wed, 25 Jan 2017 12:52:03 -0800 (PST) MIME-Version: 1.0 Received: by 10.140.101.177 with HTTP; Wed, 25 Jan 2017 12:52:03 -0800 (PST) In-Reply-To: <1684540.y5zCPFlYWp@xps13> References: <20170124210419.14084-1-emmanuel.roullit@gmail.com> <1684540.y5zCPFlYWp@xps13> From: Emmanuel Roullit Date: Wed, 25 Jan 2017 21:52:03 +0100 Message-ID: To: Thomas Monjalon Cc: dev@dpdk.org Content-Type: text/plain; charset=UTF-8 X-Content-Filtered-By: Mailman/MimeDel 2.1.15 Subject: Re: [dpdk-dev] [PATCH v2] mk: suppress error for reference of packed members X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 25 Jan 2017 20:52:05 -0000 Hi Thomas, Thanks for the hints. I will improve the patch and resubmit. Comments are present inline. Regards, - Emmanuel On Wed, Jan 25, 2017 at 11:08 AM, Thomas Monjalon wrote: > 2017-01-24 22:04, Emmanuel Roullit: > > Found with clang build: > > error: taking address of packed member 'mlock' of class or structure > > 'rte_mem_config' may result in an unaligned pointer value > > [-Werror,-Waddress-of-packed-member] > > > > Fixes: 29361d4c91ed ("mk: fix build with clang < 3.5") > > Fixes: b2bb3a5daaac ("mk: stop on warning only in developer build") > > I think these references are not correct. > The bug is due to a new version of clang, so no Fixes: tag is needed. > > You should put "clang 4" in the title. > > > Signed-off-by: Emmanuel Roullit > > --- > > > > v2: > > * Only apply compiler flag on clang >= 4.0 > > Please use --in-reply-to for grouping v2 patches with v1. > > > > --- a/mk/toolchain/clang/rte.toolchain-compat.mk > > +++ b/mk/toolchain/clang/rte.toolchain-compat.mk > > +ifeq ($(shell test $(CLANG_MAJOR_VERSION)$(CLANG_MINOR_VERSION) -ge 40 > && echo 1), 1) > > + CC_PACKED_MEMBER_WERROR := true > > +endif > > > --- a/mk/toolchain/clang/rte.vars.mk > > +++ b/mk/toolchain/clang/rte.vars.mk > > +ifeq ($(CC_PACKED_MEMBER_WERROR),true) > > +WERROR_FLAGS += -Wno-address-of-packed-member > > +endif > > So you are completely disabling the warning? > Can we assume this warning is of no interest? Yes, this changeset disables the warning completely. This warning is interesting as some architectures are sensitive to unaligned memory access (SPARC and for some instructions on ARM). ARM64 documentation says "all loads and stores support the use of unaligned addresses". [1] On ARMv7, unaligned access are supported except multiple store/load (STM/LDM) instructions. Here are the solutions I found to prevent this warning: - We could remove all packed attributes - We could add casts to (void*) which would mute the warning on specific places - We could disable the warning altogether with -Wno-address-of-packed-member The first possibility would produce a major changeset with side-effects which are hard to gauge (for me at least). The second option would litter the code with casts. It would make a large changeset and casts should be kept to a minimum. The last one is the one I picked for its brevity and effectiveness. More info on this warning here: https://reviews.llvm.org/rL278483 [1]: http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.den0024a/ch05s01s02.html >