Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp3397689img; Mon, 25 Mar 2019 09:27:50 -0700 (PDT) X-Google-Smtp-Source: APXvYqyoBTxTheaAE1VKbsm6/cxvwz/UXFY4vY+I+vAe8dJvubYelSeigF5mf3FCOV22RxGBjfof X-Received: by 2002:a17:902:7289:: with SMTP id d9mr25799391pll.314.1553531270630; Mon, 25 Mar 2019 09:27:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553531270; cv=none; d=google.com; s=arc-20160816; b=ae4/SlXM39yZa4FfQGHGKxuQSB7xmb38pvo4IM77VIHHyr357qxn83lnK9AyPMuFn3 TkMOa7VhDiPv1SI8RnOLz0tLSVAPj+3QHbCuVSmIghcl/wmaGv6/Gap/uO6xVHpicCFF 00SwlOm/kDYz7vbCftFAM+Vstx7+HlgEUZBS1ND30EOxCIJaLLK59s6NEOaqoFKG1TWU j5iA1fYNrGX6h63aSoyVRpX3R4CnDZU5nWpvY10hCTZ+/qPmVp6PVGIJhAQJx9X0aJTj OX1UTGiuElJU+yYPFontSJ8HN1zdqYp0Mkcm0utVnaCSCKU7X3WKVJsqNHbcJxtVF+Ub jkvg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :content-language:accept-language:in-reply-to:references:message-id :date:thread-index:thread-topic:subject:cc:to:from; bh=fthd6I7nlWJoxi5Ho5H0l2orev/sMB0DaXBcCL7znB0=; b=Qv0Oa1j1GRBBkZuGMYfLNLwXP81vWL/WTVM2RvM8qdCM7eUx2Na411GHBd+xulqpJv kywB/07u3H/B/J/rB5OiNac/CyhNYhSPi7C3dT32dMnOGj7rQ1YQwHw6gucGG6CAMzI1 NIey/hS784RV8jQrf/H7SYAPt9x7PevQDkiTpPHZu3QpB4UjsCKGllW3YIeykoPFu+H0 bfvRYezU2tpLX+GmXEohSs3+cOd2JOflbtNran9z0xxOo0OGRBrdi+D0pLQ78Fno8k9c ANHLjSKsYneqhBaU2iq3Fl+xOe8sIvXB/gyAlZyQStRoe6m7Fgg2fS1LuYa5c+JHiI52 0Evg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id i33si2619627pgb.99.2019.03.25.09.27.34; Mon, 25 Mar 2019 09:27:50 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729604AbfCYQ0a convert rfc822-to-8bit (ORCPT + 99 others); Mon, 25 Mar 2019 12:26:30 -0400 Received: from eu-smtp-delivery-151.mimecast.com ([146.101.78.151]:37426 "EHLO eu-smtp-delivery-151.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725788AbfCYQ0a (ORCPT ); Mon, 25 Mar 2019 12:26:30 -0400 Received: from AcuMS.aculab.com (156.67.243.126 [156.67.243.126]) (Using TLS) by relay.mimecast.com with ESMTP id uk-mta-219-8j2QYFXANHq-iCJja5DgIQ-1; Mon, 25 Mar 2019 16:26:26 +0000 Received: from AcuMS.Aculab.com (fd9f:af1c:a25b::d117) by AcuMS.aculab.com (fd9f:af1c:a25b::d117) with Microsoft SMTP Server (TLS) id 15.0.1347.2; Mon, 25 Mar 2019 16:27:30 +0000 Received: from AcuMS.Aculab.com ([fe80::43c:695e:880f:8750]) by AcuMS.aculab.com ([fe80::43c:695e:880f:8750%12]) with mapi id 15.00.1347.000; Mon, 25 Mar 2019 16:27:30 +0000 From: David Laight To: 'Andi Kleen' , Peter Zijlstra CC: Arnd Bergmann , Andi Kleen , "the arch/x86 maintainers" , Andrew Morton , Linux Kernel Mailing List , Masahiro Yamada Subject: RE: [PATCH 01/17] kbuild: Disable -Waddress-of-packed-member for gcc 9 Thread-Topic: [PATCH 01/17] kbuild: Disable -Waddress-of-packed-member for gcc 9 Thread-Index: AQHU4NCjB9yIonUPSkeI8Ri7iuki4aYci9IA Date: Mon, 25 Mar 2019 16:27:30 +0000 Message-ID: <0eef6cb14cbd460b9f66f7b24a0d34b6@AcuMS.aculab.com> References: <20190321220009.29334-1-andi@firstfloor.org> <20190321220009.29334-2-andi@firstfloor.org> <20190322163954.GG7905@worktop.programming.kicks-ass.net> <20190322165826.GE24002@tassilo.jf.intel.com> In-Reply-To: <20190322165826.GE24002@tassilo.jf.intel.com> Accept-Language: en-GB, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-exchange-transport-fromentityheader: Hosted x-originating-ip: [10.202.205.107] MIME-Version: 1.0 X-MC-Unique: 8j2QYFXANHq-iCJja5DgIQ-1 X-Mimecast-Spam-Score: 0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8BIT Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Andi Kleen > Sent: 22 March 2019 16:58 > > Lol... we're actively moving away from the C standard on many places. > > Yes and also packed is not part of the C standard. > > > Why does the silly compiler think it is a problem to take the address of > > a member of a packed structure? That sounds like something that's > > perfectly fine and useful. > > Probably because a pointer reference doesn't do whatever magic > may be needed on architectures with poor misalignment handling. > In theory you would need memcpy(). And you can't use memcpy() on a misaligned pointer because the C standard doesn't allow misaligned pointer to happen and the compiler will optimise the memcpy() to aligned register moves. > In practice it's likely a lot of false positives, like > the architectures with poor misalignment handling are usually > in SOCs without PCI and they don't have the devices > with the problematic drivers. A lot of it is code that has structures marked 'packed' when they don't need to be at all. Structures that map hardware registers probably want the 'error if any padding' check - but some people seem to think they should be 'packed'. For hardware structures that have fields on incorrect boundaries you need to mark the field member as having a lesser alignment rather than making the structure itself packed. Do it right and you can get the compiler to do 16bit accesses for a 32bit field that might be on a 4n+2 boundary. David - Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK Registration No: 1397386 (Wales)