Re: [PATCH 1/6] Kbuild: compile kernel with gnu11 std
From: Linus Torvalds
Date: Tue Mar 01 2022 - 16:15:33 EST
On Tue, Mar 1, 2022 at 1:04 PM Linus Torvalds
<torvalds@xxxxxxxxxxxxxxxxxxxx> wrote:
>
> Yeah, looks like that "<< 16" is likely just wrong.
.. and perhaps more importantly, I guess that means that -Wshift-overflow is
(a) somehow new to -std=gnu11
(b) possibly a lot more relevant and good than that
-Wshift-negative-value thing was
doing some grepping, it seems like we have never had that
'-Wshift-overflow' even in any extra warnings.
And trying it myself (keeping -std=gnu89), enabling it doesn't report
anything on a x86-64 allmodconfig build.
So I think this is likely a good new warning that -std=gnu11 brought
in by accident. No false positives that I can see, and one report for
a MIPS bug that looks real (but admittedly not a "sky-is-falling" one
;)
There's apparently a '-Wshift-overflow=2' mode too, but that warns
about things that change the sign bit, ie expressions like
1<<31
warns.
And I would not be in the least surprised if we had a ton of those
kinds of things all over (but I didn't check).
So the plain -Wshift-overflow seems to work just fine, and while it's
surprising that it got enabled by gnu11, I think it's all good.
Famous last words.
Linus