[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20220227011913.GX614@gate.crashing.org>
Date: Sat, 26 Feb 2022 19:19:13 -0600
From: Segher Boessenkool <segher@...nel.crashing.org>
To: Linus Torvalds <torvalds@...ux-foundation.org>
Cc: Arnd Bergmann <arnd@...db.de>, Jakob <jakobkoschel@...il.com>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
linux-arch <linux-arch@...r.kernel.org>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Thomas Gleixner <tglx@...utronix.de>,
Andy Shevchenko <andriy.shevchenko@...ux.intel.com>,
Andrew Morton <akpm@...ux-foundation.org>,
Kees Cook <keescook@...omium.org>,
Mike Rapoport <rppt@...nel.org>,
"Gustavo A. R. Silva" <gustavo@...eddedor.com>,
Brian Johannesmeyer <bjohannesmeyer@...il.com>,
Cristiano Giuffrida <c.giuffrida@...nl>,
"Bos, H.J." <h.j.bos@...nl>
Subject: Re: [RFC PATCH 03/13] usb: remove the usage of the list iterator after the loop
On Sat, Feb 26, 2022 at 03:03:09PM -0800, Linus Torvalds wrote:
> On Sat, Feb 26, 2022 at 2:14 PM Arnd Bergmann <arnd@...db.de> 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
Powered by blists - more mailing lists