Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3541972imu; Mon, 28 Jan 2019 06:42:56 -0800 (PST) X-Google-Smtp-Source: ALg8bN50CVrLlGYgtrLHJ7sDzqovAMesh/PQH4naUxcCDdhu6NoO17o83slWq1Y5B2l03yuK4VMo X-Received: by 2002:a17:902:e085:: with SMTP id cb5mr21797769plb.24.1548686576124; Mon, 28 Jan 2019 06:42:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548686576; cv=none; d=google.com; s=arc-20160816; b=ywOb2BTQaYBKRwHBdKdE3a+pJHAb8U5PqylndaoAzbHFTyO89abv956y8hCzPMT98A SCX06AZi1EXN6E2znOQG7rMCFh95q46Tyn7XXc4BWAIA6wV5j7kQS77uh50B+kypU/UZ WzkE9meSCsFg25+AWopI92SxDjlIw+GNfKmsbHc9QnSV/YBTTbZtBnTAr2Af4TG34ZAq YWWJIO1y54fYy7KJ5IpJVG8p/Dy4Ftc31YmI3fwqSIwc3N6+ZqbTF8+WXIc2Ut/ik+0M 2cjl+U+1ChJidvUL7ga/6aLGjhJn28n6yI8Ed0V06TY3gNn9Sm72JzmAV+IBUpcFPHyT Tr2A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version; bh=o+Cg6LHIPRoKPYT+mmxHdwfsTOOMr4ZcNvCpfOK62+g=; b=EySxsC1jRcBVpfjp74bbhrfIamMmd280+E4ZqogULfCfdBcDP6HYoXKnDVgQumTk+1 qvv5dFFuNy68rpiwEMa7rA4tpJbDXqQdL28PROOVvTKYPq7MfnDnSTXSVejOuYnxrjAc +BJan3SHBtoQy8Lejq6vIuhWWxQVMCb/Av6U/WlfIPsH5wGnx4IfdogArolAhi0JiEJk iBIUf+PTv3wXpOyAKk7Q9o/q8VrBymnKN1AX7fx/v6Tf2bmU4vpfI2JBLgdGfEV1JVn0 2XwYXQYrAPlvebCFhQI30OznpD1n48mIQeG856bEYB+r3msfGrINGiMaY+JD26cR3M5O PgGg== 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 t10si33405798pgn.551.2019.01.28.06.42.39; Mon, 28 Jan 2019 06:42:56 -0800 (PST) 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 S1726887AbfA1Okt (ORCPT + 99 others); Mon, 28 Jan 2019 09:40:49 -0500 Received: from mail-qt1-f195.google.com ([209.85.160.195]:39847 "EHLO mail-qt1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726266AbfA1Okt (ORCPT ); Mon, 28 Jan 2019 09:40:49 -0500 Received: by mail-qt1-f195.google.com with SMTP id u47so18425323qtj.6 for ; Mon, 28 Jan 2019 06:40:48 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=o+Cg6LHIPRoKPYT+mmxHdwfsTOOMr4ZcNvCpfOK62+g=; b=BiQEAgpnHr7dmkb4y2jDeLyfx+SrA5tbFMTRo3OTOYxVHvyNC0FjPhVDHIGtGi1w+O 6FPwkmfqCzFD9wlnMxlcdeYHVZAB3UwOqe7Tlg4DN8cElBwkySKAZ3sJeEb9ajOpwdic i6sI+zir/NwsdtLXb5Nb+NGXrXPJUhjrRVxrnN5qwFCAvONOb+wzbloxLbd27zqgSBwS HKY5t8OGbuz6Py3TD+DGsJHF1eLDJcevMNUkjhZCNT1JelM1HB2cDe44f2K3KKiZOkpj P5MwGNA2L+U3gRLz3qGUMtiJFPoI7P/II3FcfGE5/ACHrsrK89zSk0ZNG4QBL4ZH5IAb uRjg== X-Gm-Message-State: AJcUukfkHbZv+9bY60oRj/Ax3lEldr5SZMBYjxInIN7G3TnQ1lCBr+vG tEfIzoBOKbcDdJARPI/9zVAfJGLvv2r/uFtYogs= X-Received: by 2002:ac8:4141:: with SMTP id e1mr20661832qtm.96.1548686448016; Mon, 28 Jan 2019 06:40:48 -0800 (PST) MIME-Version: 1.0 References: <20190125104353.2791-1-labbott@redhat.com> In-Reply-To: From: Arnd Bergmann Date: Mon, 28 Jan 2019 15:40:31 +0100 Message-ID: Subject: Re: [RFC][PATCH] Update -Wattribute-alias for gcc9 To: Bernd Edlinger Cc: Miguel Ojeda , Laura Abbott , Masahiro Yamada , Linux Kernel Mailing List , Martin Sebor Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Jan 28, 2019 at 2:28 PM Bernd Edlinger wrote: > > On 1/25/19 1:24 PM, Bernd Edlinger wrote: > > On 1/25/19 12:39 PM, Miguel Ojeda wrote: > >> On Fri, Jan 25, 2019 at 11:58 AM Arnd Bergmann wrote: > >>> > >>> On Fri, Jan 25, 2019 at 11:43 AM Laura Abbott wrote: > > > > I believe it is not intentional to break the old syntax of the > > pragma. There will be new -Wattribute-alias=1 and -Wattribute-alias=2 > > and -Wattribute-alias is easy to retain as an alias for -Wattribute-alias=1. > > That is what my patch will do. > > > > Okay, I committed the -Wattribute-alias patch to gcc trunk, now > as https://gcc.gnu.org/viewcvs/gcc?view=revision&revision=268336 . > So there will be no need for a workaround on your side. > > Also fixed a few false positive -Waddress-of-packed-member warnings with > https://gcc.gnu.org/viewcvs/gcc?view=revision&revision=268118 and > https://gcc.gnu.org/viewcvs/gcc?view=revision&revision=268337 . > > However there remain a lot of warnings from -Waddress-of-packed-member, > that look more or less valid, has anybody an idea how to handle > these? The best idea I have is "one at a time", which unfortunately does mean a lot of work. We can degrade the warning to the W=1 level in the kernel by disabling it by default and re-enabling it in scripts/Makefile.extrawarn, but we probably want to address many of them anyway. Looking at the most common examples (listed by number of instances in Laura's build log) 64 warning: taking address of packed member of 'struct scif_window' may result in an unaligned pointer value [-Waddress-of-packed-member] Structure should not be packed at all, it's kernel internal (I hope at least, since it contains pointers to kernel structures), and packing it does lead to unaligned accesses. 71 warning: converting a packed 'struct desc_struct' pointer (alignment 1) to a 'u32' {aka 'unsigned int'} pointer (alignment 4) may result in an unaligned pointer value [-Waddress-of-packed-member] '__packed' does not seem to be required here. This is a structure of bit fields, which IIRC means the layout is architecture dependent, but it is fully packed already. 76 warning: converting a packed 'struct opa_smp' pointer (alignment 1) to a 'struct ib_mad_hdr' pointer (alignment 8) may result in an unaligned pointer value [-Waddress-of-packed-member] We cast the pointers multiple times, from aligned to packed and back to aligned, so I assume there is no bug, but it's unclear why the structure was ever marked as packed. 81 warning: taking address of packed member of 'struct adf_accel_dev' may result in an unaligned pointer value [-Waddress-of-packed-member] Should clearly not be packed. 122 warning: taking address of packed member of 'struct fc_els_flogi' may result in an unaligned pointer value [-Waddress-of-packed-member] I'd suggest changing it to only mark the unaligned members as packed, not the structure itself. 182 warning: taking address of packed member of 'struct rtl818x_csr' may result in an unaligned pointer value [-Waddress-of-packed-member] Cannot be packed, since this is an mmio structure, need to carefully rework structure layout in case there are some packed members we never access. 138 warning: taking address of packed member of 'struct ib_reth' may result in an unaligned pointer value [-Waddress-of-packed-member] 414 warning: taking address of packed member of 'struct ib_atomic_eth' may result in an unaligned pointer value [-Waddress-of-packed-member] I suppose ib_u64_get should take a packed argument, it already uses get_unaligned_be64() internally to avoid bugs. Arnd