From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9770CC433F5 for ; Sun, 27 Feb 2022 01:24:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229645AbiB0BZQ (ORCPT ); Sat, 26 Feb 2022 20:25:16 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49490 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229501AbiB0BZP (ORCPT ); Sat, 26 Feb 2022 20:25:15 -0500 Received: from gate.crashing.org (gate.crashing.org [63.228.1.57]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 7344615A232; Sat, 26 Feb 2022 17:24:39 -0800 (PST) Received: from gate.crashing.org (localhost.localdomain [127.0.0.1]) by gate.crashing.org (8.14.1/8.14.1) with ESMTP id 21R1JEtP000676; Sat, 26 Feb 2022 19:19:14 -0600 Received: (from segher@localhost) by gate.crashing.org (8.14.1/8.14.1/Submit) id 21R1JEI3000675; Sat, 26 Feb 2022 19:19:14 -0600 X-Authentication-Warning: gate.crashing.org: segher set sender to segher@kernel.crashing.org using -f Date: Sat, 26 Feb 2022 19:19:13 -0600 From: Segher Boessenkool To: Linus Torvalds Cc: Arnd Bergmann , Jakob , Linux Kernel Mailing List , linux-arch , Greg Kroah-Hartman , Thomas Gleixner , Andy Shevchenko , Andrew Morton , Kees Cook , Mike Rapoport , "Gustavo A. R. Silva" , Brian Johannesmeyer , Cristiano Giuffrida , "Bos, H.J." Subject: Re: [RFC PATCH 03/13] usb: remove the usage of the list iterator after the loop Message-ID: <20220227011913.GX614@gate.crashing.org> References: <20220217184829.1991035-1-jakobkoschel@gmail.com> <20220217184829.1991035-4-jakobkoschel@gmail.com> <6DFD3D91-B82C-469C-8771-860C09BD8623@gmail.com> <20220226124249.GU614@gate.crashing.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.4.2.3i Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, Feb 26, 2022 at 03:03:09PM -0800, Linus Torvalds wrote: > On Sat, Feb 26, 2022 at 2:14 PM Arnd Bergmann wrote: > > > > Could gcc follow the clang behavior then and skip the warning and > > sanitizer for this case when -fno-strict-overflow or -fwrapv are used? > > Well, for the kernel, that horse has already left the barn, and we'd > have to use -Wno-shift-negative-value anyway. > > But yes, from a sanity standpoint, it would be good to shut that > warning up automatically if compiling for a 2's complement machine (ie > "all of them") with -fwrapv. > > Considering that gcc doesn't support any non-2's-complement machines > anyway afaik, * 'Whether signed integer types are represented using sign and magnitude, two's complement, or one's complement, and whether the extraordinary value is a trap representation or an ordinary value (C99 and C11 6.2.6.2).' GCC supports only two's complement integer types, and all bit patterns are ordinary values. > and that the C standards people are also fixing the > standard, and gcc has never done anything odd in this area in the > first place, I think the warning is probably best removed entirely. Well, not removed, it correctly identifies (formally) undefined behaviour after all; but I agree it should not be in -Wextra. -Wall should include the warnings that have a very good balance for usefulness, number of false postives, seriousness of problems found. -Wextra is exactly the same conditions, just a slightly lower bar. -Wall should be useful for everyone. -Wall -W should be good for most people. > But we'll have to do it manually for the existing situation. Yes, sorry about that :-/ Segher